Wallaroo  0.8
Public Member Functions | List of all members
wallaroo::JsonConfiguration Class Reference

#include <jsonconfiguration.h>

Inheritance diagram for wallaroo::JsonConfiguration:
wallaroo::detail::PtreeBasedCfg

Public Member Functions

 JsonConfiguration (const std::string &fileName)
 
void LoadPlugins ()
 
void Fill (Catalog &catalog)
 

Detailed Description

This class can parse a json file containing a list of objects to be created and their wiring. Then it can populate a Catalog with that objects. The syntax of the json file should be similar to:

{
"wallaroo":
{
"plugins":
{
"shared": "pluginName"
},
"parts":
[
{
"name": "instance1",
"class": "className1"
},
{
"name": "instance2",
"class": "className2",
"attribute":
{
"name": "attr1_name",
"value": "attr1_string_value"
},
"attribute":
{
"name": "attr2_name",
"value": attr2_value
}
},
{
"name": "instance3",
"class": "className3",
"parameter1":
{
"type": "string",
"value": "mystring"
},
"parameter2":
{
"type": "int",
"value": 34
}
}
],
"wiring":
[
{
"source": "sourceInstance",
"dest": "targetInstance",
"collaborator": "collaboratorName"
},
{
"source": "sourceInstance2",
"dest": "targetInstance2",
"collaborator": "collaboratorName2"
}
]
}
}

Constructor & Destructor Documentation

wallaroo::JsonConfiguration::JsonConfiguration ( const std::string &  fileName)
inlineexplicit

Create a JsonConfiguration from the path specified as parameter.

Parameters
fileNameThe path of the file to parse
Exceptions
WrongFileIf the file does not exist or its format is wrong.

Member Function Documentation

void wallaroo::JsonConfiguration::Fill ( Catalog catalog)
inline

Fill the catalog with the objects and relations specified in the file.

Parameters
catalogThe catalog target of the new items of the file.
Exceptions
WrongFileIf the file contains a semantic error.
void wallaroo::JsonConfiguration::LoadPlugins ( )
inline

Load the plugins (shared libraries) specified in the file.

Exceptions
WrongFileIf the file contains a semantic error.

The documentation for this class was generated from the following file: