Wallaroo  0.8
Classes | Public Member Functions | Friends | List of all members
wallaroo::Configuration Class Reference

#include <configuration.h>

Public Member Functions

 Configuration (const std::string &file)
 
 Configuration (std::istream &s)
 
void LoadPlugins ()
 
void Fill (Catalog &catalog)
 

Friends

class detail::Grammar< Configuration >
 

Detailed Description

This class can parse a configuration written in WAL format, by reading the content from a file or from a std::istream, containing a list of objects to be created and their wiring. Then it can populate a Catalog with that objects. The syntax of the wal file should be similar to:

# this is a comment
@load "plugin"; # load the dynamic library named "plugin.so" or "plugin.dll"
a = new A8; # create a new object of class A8
a1 = new A8(); # idem
b = new B8( att_int=10); # create an object of class B8 assigning an attribute
c1 = new C8(att_ui=10);
c2 = new C8(att_ui=10);
d = new Foo::D8(att_string="mystring",att_int=34);
e = new E8( att1=5, att2=3.14 );
f = new F8(att1=3.14,att2=false);
g = new G8(att1=false,att2=true);
h = new H8(att1=1.0, att2=-2.0);
l = new L8(att1=-100, att2="foo bar");
m = new M8(att1=-2000000000, att2='a');
n = new N8(att1='b',att2=200);
o_double = new O8<double>;
o_int = new O8<int>;
p = new P5;
q = new Q5;
c1.x=a; # link "x" collaborator of the object "c1" to the part "a"
c2.x=b;
d.container=a;
d.container=b;

The syntax in Backus-Naur form is the following:

<start> ::= <list> <done>
<list> ::= <statement> ";" <list> | <empty>
<statement> ::= <loadexpr> | <assignexpr>
<loadexpr> ::= "@load" <value>
<assignexpr> ::= <id> "=" "create" <id> <optparamlist> | <id> <depexpr>
<optparamlist> ::= <empty> | "(" <attrlist> ")"
<attrlist> ::= <empty> | <attrassign> <moreattrassign>
<attrassign> ::= <id> "=" <value>
<moreattrassign> ::= <empty> | attrsep <attrassign>
<depexpr> ::= "." <id> "=" <id>

Constructor & Destructor Documentation

wallaroo::Configuration::Configuration ( const std::string &  file)
inlineexplicit

Create a Configuration from the path specified as parameter.

Parameters
fileNameThe path of the file to parse.
Exceptions
WrongFileIf the file does not exist.
SyntaxErrorIf the content is invalid.
wallaroo::Configuration::Configuration ( std::istream &  s)
inlineexplicit

Create a Configuration from the std::istream specified as parameter.

Parameters
sThe input stream to parse
Exceptions
SyntaxErrorIf the content is invalid.

Member Function Documentation

void wallaroo::Configuration::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
DuplicatedElementIf more elements share the same name.
ElementNotFoundIf the configuration use a class name not registered or an object not created.
WrongTypeIf an assignment (attribute or dependency) has type mismatch.
void wallaroo::Configuration::LoadPlugins ( )
inline

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

Exceptions
WrongFileif one of the file specified does not exists or its format is wrong

Friends And Related Function Documentation

friend class detail::Grammar< Configuration >
friend

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