Datalayer hierarchy in c++

Hello,

I am trying to create a hierarchy of nodes and folder in the datalayer and I am facing an issue with that.

When I create a folder on the datalayer which contains only nodes of different types, it goes smoothely without any problem. The problem starts when I want to create a Folder that contains nodes and other folders which also contains nodes.

The goal hierarchy:

  • Root
    • node1 (boolean node)
    • parent1
      • child1 (boolean node)

I tried several ways of doing that as follows: (The arguments of RegisterNodes are the name of the node, type and array length, I customized it to achieve certain goals)

Trial1:

auto Object = new ProviderNodeAllData(dlProvider, "Root", true);
Object->RegisterNodes("node1", "bool8", 0);
Object = new ProviderNodeAllData(dlProvider, "Root", true);
Object->RegisterNodes("Parent1/Child1", "bool8", 0);

Trial2:

 auto Object = new ProviderNodeAllData(dlProvider, "Root", true);
 Object->RegisterNodes("node1", "bool8", 0);
 Object = new ProviderNodeAllData(dlProvider, "Root/Parent1", true);
 Object->RegisterNodes("child1", "bool8", 0);

Trial3:

auto Object = new ProviderNodeAllData(dlProvider, "Root", true);
Object->RegisterNodes("node1", "bool8", 0);
auto Object2 = new ProviderNodeAllData(dlProvider, "Root/Parent1", true);
Object2->RegisterNodes("child1", "bool8", 0);

 Trial4:

auto Object = new ProviderNodeAllData(dlProvider, "Root", true);
Object->RegisterNodes("node1", "bool8", 0);
auto Object2 = new ProviderNodeAllData(dlProvider, "Root", true);
Object2->RegisterNodes("Parent1/child1", "bool8", 0);

 The issue is as shown in the picture, the folder doesn't have metadata:

 

Here is a part of registerNodes function:

void ProviderNodeAllData::RegisterNodes(std::string name, std::string type, int32_t ArrayLength)
{

  comm::datalayer::DlResult result;
  comm::datalayer::Variant data;

  result = _provider->registerNode(_addressBase + "**", this);
  //These if statments checks the datatype of the node to be registered and create that node for non arrays
  if(type == "bool8" && ArrayLength == 0){
    result = data.setValue(false);
    createDataContainer(result, name, data);
.
.
.
.
}

 

Your help is highly appreciated.

Regards,

Osama

Best reply by nickH

Hello Osama, 

the problem in the Data Layer are the missing metadata for your folder. Metadata for nodes can be provided as follows (see documentation) :

  • Via the ‪onMetadata()‬ of a ‪ProviderNodes‬
  • Or via a metadata database (MDDB)

 

In the sample samples-cpp/datalayer.register.node you can see an example where this is done via the metadata database. A metadata database is provided via CSV file. I changed the sample and tested it for a similar structure like you have (see screenshot). 

 

You can try out my main.cpp and metadata.csv if you paste it into the sdk-sample (sample-cpp/datalayer.register.node).

Best regards, 

Nick

 

metadata.csv
718B
main.cpp
9.66KB
View original
5 replies