Warning [2] Undefined array key "lockoutexpiry" - Line: 94 - File: global.php PHP 8.1.27 (FreeBSD)
File Line Function
/global.php 94 errorHandler->error
/showthread.php 28 require_once
Warning [2] Undefined array key "lockoutexpiry" - Line: 550 - File: global.php PHP 8.1.27 (FreeBSD)
File Line Function
/global.php 550 errorHandler->error
/showthread.php 28 require_once
Warning [2] Undefined array key "avatartype" - Line: 811 - File: global.php PHP 8.1.27 (FreeBSD)
File Line Function
/global.php 811 errorHandler->error
/showthread.php 28 require_once
Warning [2] Undefined array key "avatartype" - Line: 811 - File: global.php PHP 8.1.27 (FreeBSD)
File Line Function
/global.php 811 errorHandler->error
/showthread.php 28 require_once
Warning [2] Undefined variable $awaitingusers - Line: 26 - File: global.php(872) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/global.php(872) : eval()'d code 26 errorHandler->error
/global.php 872 eval
/showthread.php 28 require_once
Warning [2] Undefined array key 1 - Line: 1449 - File: inc/functions.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions.php 1449 errorHandler->error
/inc/functions.php 1414 fetch_forum_permissions
/inc/functions.php 2953 forum_permissions
/showthread.php 657 build_forum_jump
Warning [2] Undefined array key "mybb" - Line: 1997 - File: inc/functions.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions.php 1997 errorHandler->error
/inc/functions_indicators.php 41 my_set_array_cookie
/showthread.php 665 mark_thread_read
Warning [2] Undefined array key "additionalgroups" - Line: 7360 - File: inc/functions.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions.php 7360 errorHandler->error
/inc/functions_user.php 813 is_member
/inc/functions_post.php 416 purgespammer_show
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(484) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php(484) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 484 eval
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 672 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 672 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showimages" - Line: 757 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 757 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 762 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 762 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7360 - File: inc/functions.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions.php 7360 errorHandler->error
/inc/functions_user.php 813 is_member
/inc/functions_post.php 416 purgespammer_show
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(484) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php(484) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 484 eval
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 672 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 672 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showimages" - Line: 757 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 757 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 762 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 762 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7360 - File: inc/functions.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions.php 7360 errorHandler->error
/inc/functions_user.php 813 is_member
/inc/functions_post.php 416 purgespammer_show
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(484) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php(484) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 484 eval
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 672 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 672 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showimages" - Line: 757 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 757 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 762 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 762 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7360 - File: inc/functions.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions.php 7360 errorHandler->error
/inc/functions_user.php 813 is_member
/inc/functions_post.php 416 purgespammer_show
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(484) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php(484) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 484 eval
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 672 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 672 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showimages" - Line: 757 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 757 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 762 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 762 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7360 - File: inc/functions.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions.php 7360 errorHandler->error
/inc/functions_user.php 813 is_member
/inc/functions_post.php 416 purgespammer_show
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(484) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php(484) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 484 eval
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 672 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 672 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showimages" - Line: 757 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 757 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 762 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 762 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined variable $threadnotesbox - Line: 33 - File: showthread.php(1587) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/showthread.php(1587) : eval()'d code 33 errorHandler->error
/showthread.php 1587 eval
Warning [2] Undefined variable $ratethread - Line: 41 - File: showthread.php(1587) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/showthread.php(1587) : eval()'d code 41 errorHandler->error
/showthread.php 1587 eval
Warning [2] Undefined variable $addremovesubscription - Line: 82 - File: showthread.php(1587) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/showthread.php(1587) : eval()'d code 82 errorHandler->error
/showthread.php 1587 eval
Warning [2] Undefined variable $usersbrowsing - Line: 92 - File: showthread.php(1587) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/showthread.php(1587) : eval()'d code 92 errorHandler->error
/showthread.php 1587 eval
Warning [2] Undefined variable $thread_deleted - Line: 107 - File: showthread.php(1587) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/showthread.php(1587) : eval()'d code 107 errorHandler->error
/showthread.php 1587 eval

My own xml nodes
The following warnings occurred:
Warning [2] Undefined array key "lockoutexpiry" - Line: 94 - File: global.php PHP 8.1.27 (FreeBSD)
File Line Function
/global.php 94 errorHandler->error
/showthread.php 28 require_once
Warning [2] Undefined array key "lockoutexpiry" - Line: 550 - File: global.php PHP 8.1.27 (FreeBSD)
File Line Function
/global.php 550 errorHandler->error
/showthread.php 28 require_once
Warning [2] Undefined array key "avatartype" - Line: 811 - File: global.php PHP 8.1.27 (FreeBSD)
File Line Function
/global.php 811 errorHandler->error
/showthread.php 28 require_once
Warning [2] Undefined array key "avatartype" - Line: 811 - File: global.php PHP 8.1.27 (FreeBSD)
File Line Function
/global.php 811 errorHandler->error
/showthread.php 28 require_once
Warning [2] Undefined variable $awaitingusers - Line: 26 - File: global.php(872) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/global.php(872) : eval()'d code 26 errorHandler->error
/global.php 872 eval
/showthread.php 28 require_once
Warning [2] Undefined array key 1 - Line: 1449 - File: inc/functions.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions.php 1449 errorHandler->error
/inc/functions.php 1414 fetch_forum_permissions
/inc/functions.php 2953 forum_permissions
/showthread.php 657 build_forum_jump
Warning [2] Undefined array key "mybb" - Line: 1997 - File: inc/functions.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions.php 1997 errorHandler->error
/inc/functions_indicators.php 41 my_set_array_cookie
/showthread.php 665 mark_thread_read
Warning [2] Undefined array key "additionalgroups" - Line: 7360 - File: inc/functions.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions.php 7360 errorHandler->error
/inc/functions_user.php 813 is_member
/inc/functions_post.php 416 purgespammer_show
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(484) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php(484) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 484 eval
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 672 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 672 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showimages" - Line: 757 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 757 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 762 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 762 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7360 - File: inc/functions.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions.php 7360 errorHandler->error
/inc/functions_user.php 813 is_member
/inc/functions_post.php 416 purgespammer_show
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(484) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php(484) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 484 eval
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 672 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 672 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showimages" - Line: 757 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 757 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 762 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 762 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7360 - File: inc/functions.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions.php 7360 errorHandler->error
/inc/functions_user.php 813 is_member
/inc/functions_post.php 416 purgespammer_show
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(484) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php(484) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 484 eval
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 672 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 672 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showimages" - Line: 757 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 757 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 762 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 762 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7360 - File: inc/functions.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions.php 7360 errorHandler->error
/inc/functions_user.php 813 is_member
/inc/functions_post.php 416 purgespammer_show
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(484) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php(484) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 484 eval
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 672 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 672 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showimages" - Line: 757 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 757 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 762 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 762 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7360 - File: inc/functions.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions.php 7360 errorHandler->error
/inc/functions_user.php 813 is_member
/inc/functions_post.php 416 purgespammer_show
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(484) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php(484) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 484 eval
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 672 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 672 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showimages" - Line: 757 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 757 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 762 - File: inc/functions_post.php PHP 8.1.27 (FreeBSD)
File Line Function
/inc/functions_post.php 762 errorHandler->error
/showthread.php 1114 build_postbit
Warning [2] Undefined variable $threadnotesbox - Line: 33 - File: showthread.php(1587) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/showthread.php(1587) : eval()'d code 33 errorHandler->error
/showthread.php 1587 eval
Warning [2] Undefined variable $ratethread - Line: 41 - File: showthread.php(1587) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/showthread.php(1587) : eval()'d code 41 errorHandler->error
/showthread.php 1587 eval
Warning [2] Undefined variable $addremovesubscription - Line: 82 - File: showthread.php(1587) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/showthread.php(1587) : eval()'d code 82 errorHandler->error
/showthread.php 1587 eval
Warning [2] Undefined variable $usersbrowsing - Line: 92 - File: showthread.php(1587) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/showthread.php(1587) : eval()'d code 92 errorHandler->error
/showthread.php 1587 eval
Warning [2] Undefined variable $thread_deleted - Line: 107 - File: showthread.php(1587) : eval()'d code PHP 8.1.27 (FreeBSD)
File Line Function
/showthread.php(1587) : eval()'d code 107 errorHandler->error
/showthread.php 1587 eval






My own xml nodes
#1
Apost 
Hi!

Is it possible to create my own nodes (with custom name and attributes) and use them inside a graph resource xml along with the other nodes?

Thanks in advance Smile
Reply
#2
Apost 
Hi!

You can do so by deriving from Graph::Node.

In the header file, write:
#include "murl_graph_node.h"
#include "app_i_my_node.h"

namespace Murl
{
    namespace App
    {
        class MyNode : public IMyNode, public Graph::Node
        {
            // Declare the attributes here:

            MURL_DECLARE_FACTORY_OBJECT_BEGIN(App::MyNode)
                MURL_DECLARE_FACTORY_OBJECT_PROPERTY(PROPERTY_MY_ATTR)
            MURL_DECLARE_FACTORY_OBJECT_END(App::MyNode)
            
            static INode* Create(const Graph::IFactory* factory);

        public:
            virtual Graph::INode* GetNodeInterface();
            virtual const Graph::INode* GetNodeInterface() const;

        protected:
            MyNode(const Graph::IFactory* factory);
            virtual ~MyNode();
            virtual Bool DeserializeBaseAttribute(Graph::IDeserializeAttributeTracker* tracker);

            // Use member variables to store attribute values.

            SInt32 mMyAttr;
        };
    }
}


Then implement in the CPP file:
using namespace Murl;

// Define the attributes here:

MURL_DEFINE_FACTORY_OBJECT_BEGIN(App::MyNode)
    MURL_DEFINE_FACTORY_OBJECT_PROPERTY(PROPERTY_MY_ATTR, "myAttr")
MURL_DEFINE_FACTORY_OBJECT_END(App::MyNode)

Graph::INode* App::MyNode::Create(const Graph::IFactory* factory)
{
    return new MyNode(factory);
}

App::MyNode::MyNode(const Graph::IFactory* factory)
: Graph::Node(factory)
, mMyAttr(0)
{
}

App::MyNode::~MyNode()
{
}

Graph::INode* App::MyNode::GetNodeInterface()
{
    return this;
}

const Graph::INode* App::MyNode::GetNodeInterface() const
{
    return this;
}

Bool App::MyNode::DeserializeBaseAttribute(Graph::IDeserializeAttributeTracker* tracker)
{
    switch(tracker->GetBaseAttributeProperty(GetProperties()))
    {
        case PROPERTY_MY_ATTR:
            tracker->GetAttributeValue(mMyAttr);
            return true;

        // handle other attributes here

        default:
            return Graph::Node::DeserializeBaseAttribute(tracker);
    }
}


You may want to override the InitSelf, ProcessLogicSelf, etc. methods from Graph::Node to add custom behavior.

Finally, you need to register/unregister the node in your App class by overriding these methods from AppBase:
Bool App::MyApp::RegisterCustomFactoryClasses(IAppFactoryRegistry* factoryRegistry)
{
    factoryRegistry->GetGraphFactoryRegistry()->RegisterNodeClass(App::MyNode::GetClassInfo());
    return true;
}

Bool App::MyApp::UnregisterCustomFactoryClasses(IAppFactoryRegistry* factoryRegistry)
{
    factoryRegistry->GetGraphFactoryRegistry()->UnregisterNodeClass(App::MyNode::GetClassInfo());
    return true;
}


Now you can use:

<App::MyNode myAttr="42"/>


Or:

<MyNode myAttr="42"/>


Wink
Reply
#3
Apost 
Thank you very much for your help!
This is exactly what I wanted.

I knew there has to be an easy way. Smile
Reply
#4
Apost 
Is this information still valid, or does it need to be updated slightly?

I tried this with murl_1.00.5225beta, however I get a bunch of compiler errors with the macros (MURL_DECLARE_FACTORY_OBJECT_BEGIN, MURL_DECLARE_FACTORY_OBJECT_PROPERTY and MURL_DECLARE_FACTORY_OBJECT_END)


P.S. I know some forums frown upon resurrecting old threads like this, if that's the case just let me know and I'll create a new thread for my questions Smile.
Reply
#5
Apost 
Thanks for the info; the way how custom nodes are defined has changed indeed. Here's an updated version of the above class that reflects the necessary changes:


Header file snippet:
#include "murl_graph_node.h"

namespace Murl
{
    namespace App
    {
        class MyNode : public Graph::Node
        {
            // Define the class, including its base class
            MURL_FACTORY_OBJECT_DERIVED_CLASS(App::MyNode, Murl::Graph::Node)

            // Define node properties, this creates a member variable for each property and assigns a given default value.
            MURL_FACTORY_OBJECT_PROPERTIES(App::MyNode,
                                           (PROPERTY_MY_ATTR_1, mMyAttr1, 42,  Graph::SInt32Property),
                                           (PROPERTY_MY_ATTR_2, mMyAttr2, "42", Graph::StringProperty))

            // Define the attributes for deserialization; these bind to individual properties defined above
            MURL_FACTORY_OBJECT_ATTRIBUTES(App::MyNode,
                                           (ATTRIBUTE_MY_ATTR_1, "myAttr1", mMyAttr1, COMPONENT_SINGLE, ACCESS_SINGLE, ELEMENT_SINGLE),
                                           (ATTRIBUTE_MY_ATTR_2, "myAttr2", mMyAttr2, COMPONENT_SINGLE, ACCESS_SINGLE, ELEMENT_SINGLE))

            // The static creation method
            static INode* Create(const Graph::IFactory* factory);

        public:
            virtual Graph::INode* GetNodeInterface();
            virtual const Graph::INode* GetNodeInterface() const;

        protected:
            MyNode(const Graph::IFactory* factory);
            virtual ~MyNode();

            virtual Bool DeserializeBaseAttribute(Graph::IDeserializeAttributeTracker* tracker);
        };
    }
}


CPP file snippet:
using namespace Murl;

// No need for macros in the CPP file anymore, this is all done in the
// header file now.

Graph::INode* App::MyNode::Create(const Graph::IFactory* factory)
{
    return new MyNode(factory);
}

App::MyNode::MyNode(const Graph::IFactory* factory)
: Graph::Node(factory)
{
    // Also, no need to initialize members. this is done in the
    // MURL_FACTORY_OBJECT_PROPERTIES macro.
}

App::MyNode::~MyNode()
{
}

Graph::INode* App::MyNode::GetNodeInterface()
{
    return this;
}

const Graph::INode* App::MyNode::GetNodeInterface() const
{
    return this;
}

Bool App::MyNode::DeserializeBaseAttribute(Graph::IDeserializeAttributeTracker* tracker)
{
    switch (tracker->GetBaseAttribute(GetAttributeInfo()))
    {
        case PROPERTY_MY_ATTR_1:
            return mMyAttr1.DeserializeValue(tracker);

        case PROPERTY_MY_ATTR_2:
            return mMyAttr2.DeserializeValue(tracker);

            // handle other attributes here

        default:
            return Graph::Node::DeserializeBaseAttribute(tracker);
    }
}


This is just a basic example using two simple properties/attributes. There's a bunch of other data types available, see the file murl/base/include/engine/graph/murl_graph_property.h; however we are still lacking thorough documentation on the whole topic of user-defined node creation.

Feel free to ask if you need something more specific.

As for resurrecting old threads: We're quite relaxed about doing so as long as it's not totally off-topic or exhaustive Wink

Best regards,

dizzy
Reply


Forum Jump:


Copyright © 2011-2024 Spraylight GmbH.