/** \brief Constructor
 */
log_layer_t::log_layer_t(const log_level_t &default_level)		throw()
{
	// sanity check - the default level MUST NOT be null
	DBG_ASSERT( !default_level.is_null() );
	// copy the parameter
	this->default_level	= default_level;
	// allocate the property
	prop_file	= nipmem_new property_t();
	prop_category	= nipmem_new property_t();
}
Exemple #2
0
    void BehaviorNode::load_properties(int version, const char* agentType, rapidxml::xml_node<>* node)
    {
#if !defined(BEHAVIAC_RELEASE)
        this->m_agentType = agentType;
#endif//#ifdef _DEBUG

        properties_t properties;

        rapidxml::xml_node<>* nodesProperty = node->first_node(kStrProperty);

        for (rapidxml::xml_node<>* attachmentNode = nodesProperty; attachmentNode; attachmentNode = attachmentNode->next_sibling())
        {
            if (StringUtils::StrEqual(attachmentNode->name(), kStrProperty))
            {
                if (rapidxml::xml_attribute<>* attr = attachmentNode->first_attribute())
                {
                    //std::cout << attr->name() << ":" << attr->value() << std::endl;
                    const char* pPropertyName = attr->name();
                    const char* pPropertyValue = attr->value();
                    properties.push_back(property_t(pPropertyName, pPropertyValue));
                }
            }
        }

        if (properties.size() > 0)
        {
            this->load(version, agentType, properties);
        }
    }
Exemple #3
0
    bool BehaviorNode::load_property_pars(properties_t& properties, rapidxml::xml_node<>* c, int version, const char* agentType)
    {
        if (StringUtils::StrEqual(c->name(), kStrProperty))
        {
            if (rapidxml::xml_attribute<>* attr = c->first_attribute())
            {
                //std::cout << attr->name() << ":" << attr->value() << std::endl;
                const char* pPropertyName = attr->name();
                const char* pPropertyValue = attr->value();
                properties.push_back(property_t(pPropertyName, pPropertyValue));
            }

            return true;

        }
        else if (StringUtils::StrEqual(c->name(), kStrPars))
        {
            rapidxml::xml_node<>* children = c->first_node();

            if (children != NULL)
            {
                for (rapidxml::xml_node<>* child = children; child; child = child->next_sibling())
                {
                    if (StringUtils::StrEqual(child->name(), kStrPar))
                    {
                        this->load_par(version, agentType, child);
                    }
                }
            }

            return true;
        }

        return false;
    }
Exemple #4
0
    void BehaviorNode::load_properties(int version, const char* agentType, BsonDeserizer& d)
    {
#if !BEHAVIAC_RELEASE
        this->m_agentType = agentType;
#endif
        d.OpenDocument();

        //load property after loading par as property might reference par

        properties_t properties;

        behaviac::BsonDeserizer::BsonTypes type = d.ReadType();

        while (type == BsonDeserizer::BT_String)
        {
            const char* propertyName = d.ReadString();
            const char* propertyValue = d.ReadString();

            properties.push_back(property_t(propertyName, propertyValue));

            type = d.ReadType();
        }

        if (properties.size() > 0)
        {
            this->load(version, agentType, properties);
        }

        //BEHAVIAC_ASSERT(type == BsonDeserizer.BsonTypes.BT_None);
        BEHAVIAC_ASSERT(type == BsonDeserizer::BT_None);
        d.CloseDocument(false);
    }