CProperty

Sample code

/**
 *  @file main.cpp
 *
 *  @author Manfred Morgner
 *  @date 10.02.2018
 */

#include <iostream>

#include "odb.h"


/// @brief Demo main program for "property in node"
int main()
   {
   auto oOdb = odb::COdb();
   auto node = oOdb.MakeNode( "Tree" );
   auto property = oOdb.MakeProperty( "Acorn" );
   node->Append(property);
   std::cout << "node: " << *node;
   std::cout << '\n';
   }

Output

thing: Tree
  Property: Acorn
class CProperty : public Identifiable<CProperty>

A Property for a CNode.

Public Functions

CProperty()

DELETED: default constructor.

CProperty(CProperty const&)

DELETED: There is no reason to copy a CProperty.

CProperty(CProperty&&)

DEFAULT, NOEXCEP: There is no reason to move-construct a CProperty.

CProperty(std::string const &crsName)

Normal constructor, receiving the name of the property.

CProperty(size_t nId, std::string const &crsName)

Load constructor, receiving the id and the name of the property.

virtual ~CProperty()

DEFAULT, NOEXCEPT: destructor.

operator std::string const&()

Conversion operator will return the name of the instance.

void RelationAdd(PNode poNode)

Add the information about a link from a CNode.

void RelationSub(PNode poNode)

Removes a link to a CNode.

Parameters
  • poNode: The node the link is pointing to

void print()

Prints an informational output to std::cout.

auto IsUnUsed()

returns if the instance is ‘free’

SNodes const &Relations() const

Access function to call then container of PNodes’s.

Public Static Attributes

constexpr auto s_csNameUnnamedProperty = {"unnamedProperty"}

The name of an unnamed property.

Friends

std::ostream &operator<<(std::ostream &ros, CProperty const &croProperty)

Output operator to do an output of the instance.