ANNA Suite  2020b
Multipurpose development suite for Telco applications
Public Types | Public Member Functions | Friends | List of all members
anna::diameter::stack::Engine Class Reference

#include <Engine.hpp>

Inheritance diagram for anna::diameter::stack::Engine:
Inheritance graph
[legend]
Collaboration diagram for anna::diameter::stack::Engine:
Collaboration graph
[legend]

Public Types

typedef std::map< unsigned int, Dictionary * > stack_container
 
typedef stack_container::const_iterator const_stack_iterator
 
typedef stack_container::iterator stack_iterator
 

Public Member Functions

const DictionarygetDictionary (unsigned int stackId) const
 
const_stack_iterator stack_begin () const
 
const_stack_iterator stack_end () const
 
int stack_size () const
 
bool isEmpty (void) const
 
std::string asString (bool all=true) const
 
DictionarycreateDictionary (unsigned int stackId, const std::string &xmlPathFile="") noexcept(false)
 
DictionaryregisterDictionary (unsigned int stackId, Dictionary *dictionary) noexcept(false)
 
void loadDictionary (const std::vector< unsigned int > &stacks, const std::string &xmlPathFile) noexcept(false)
 
void loadDictionary (const std::string &xmlPathFile) noexcept(false)
 
void removeStacks (void)
 
void removeStack (unsigned int stackId)
 

Friends

class anna::Singleton< Engine >
 
class Dictionary
 

Additional Inherited Members

- Static Public Member Functions inherited from anna::Singleton< T >
static T & instantiate ()
 
static void release ()
 

Detailed Description

Engine information

Member Typedef Documentation

◆ const_stack_iterator

typedef stack_container::const_iterator anna::diameter::stack::Engine::const_stack_iterator

◆ stack_container

◆ stack_iterator

typedef stack_container::iterator anna::diameter::stack::Engine::stack_iterator

Member Function Documentation

◆ asString()

std::string anna::diameter::stack::Engine::asString ( bool  all = true) const

Class string representation

Parameters
allComplete engine information versus only stacks list with its ids and dictionary names
Returns
String with class content

◆ createDictionary()

Dictionary* anna::diameter::stack::Engine::createDictionary ( unsigned int  stackId,
const std::string &  xmlPathFile = "" 
)
noexcept

Creates a diameter dictionary based on xml document file and store it over the provided stack identifier. If the stack is currently used, an exception will be launched to notify the stack collision (a dictionary could be removed with removeStack). If missing xml path file, the dictionary will be created without loading data.

Method 1 - Create and load xml data (commonly used for mono-load stacks):
    engine->createDictionary(MMS_STACK_ID, "/var/tmp/mms.xml");
Method 2 - Create and then, load xml data (useful for multi-load stacks):
    Dictionary * d = engine->createDictionary(MMS_STACK_ID);
    // Loading data:
    d->load("/var/tmp/mms.xml");
    ...
Method 3 - Create and then, load data through Dictionary API (*):
    Dictionary * d = engine->createDictionary(MMS_STACK_ID);
    // Loading data:
    d->addFormat(...);
    d->addVendor(...);
    ...
(*) Applications could create a dictionary with its own API (Dictionary) but it is much more difficult,
    and usually, the method version with xml document load is used instead of this.
Parameters
stackIdStack identifier for created dictionary. We recommend to use the Diameter 'Application-Id' unless the application is going to use dictionaries covering different applications (which is not very usual).
xmlPathFilePath file to the xml document which represents the diameter dictionary.
Returns
Dictionary registered. When exception happen, dictionary can be accessed by getDictionary

◆ getDictionary()

const Dictionary* anna::diameter::stack::Engine::getDictionary ( unsigned int  stackId) const

Returns the dictionary registered with the provided identifier, which commonly is the 'Application-Id'.

Parameters
stackIdStack identifier.
Returns
Dictionary reference, NULL if no stack found

◆ isEmpty()

bool anna::diameter::stack::Engine::isEmpty ( void  ) const
inline

Gets boolean about empty stack condition

Returns
Boolean about empty stack condition
74 { return (!a_stacks.size()); }
Here is the call graph for this function:

◆ loadDictionary() [1/2]

void anna::diameter::stack::Engine::loadDictionary ( const std::vector< unsigned int > &  stacks,
const std::string &  xmlPathFile 
)
noexcept

Loads an XML dictionary document over the diameter stack identifiers (one or more stack id's). Passing more than one stack id, synchronized loadings are performed, which could be useful when an application loads many dictionaries with common avps.

Parameters
stacksStacks identifiers over which the dictionary will be load.
xmlPathFilePath file to the xml document which represents the diameter dictionary.

◆ loadDictionary() [2/2]

void anna::diameter::stack::Engine::loadDictionary ( const std::string &  xmlPathFile)
noexcept

Loads an XML dictionary document over all the diameter engine registered stacks. When more than one stack id is used, synchronized loadings are performed, which could be useful when an application loads many dictionaries with common avps.

Parameters
xmlPathFilePath file to the xml document which represents the diameter dictionary.

◆ registerDictionary()

Dictionary* anna::diameter::stack::Engine::registerDictionary ( unsigned int  stackId,
Dictionary dictionary 
)
noexcept

Register a externally created Dictionary or a derived class from Dictionary

Parameters
stackIdStack identifier for provided dictionary. We recommend to use the Diameter 'Application-Id' unless the application is going to use dictionaries covering different applications (which is not very usual).
dictionaryExternally created dictionary
Returns
Dictionary registered. When exception happen, dictionary can be accessed by getDictionary

◆ removeStack()

void anna::diameter::stack::Engine::removeStack ( unsigned int  stackId)

Remove the stack provided.

Parameters
stackIdStack identifier for created dictionary

◆ removeStacks()

void anna::diameter::stack::Engine::removeStacks ( void  )
inline

Remove all stacks registered on diameter stack engine

155 { a_stacks.clear(); }
Here is the call graph for this function:

◆ stack_begin()

const_stack_iterator anna::diameter::stack::Engine::stack_begin ( ) const
inline

Beginning stack iterator

62 { return a_stacks.begin(); }

◆ stack_end()

const_stack_iterator anna::diameter::stack::Engine::stack_end ( ) const
inline

Ending stack iterator

64 { return a_stacks.end(); }

◆ stack_size()

int anna::diameter::stack::Engine::stack_size ( ) const
inline

Stack size

66 { return a_stacks.size(); }

Friends And Related Function Documentation

◆ anna::Singleton< Engine >

friend class anna::Singleton< Engine >
friend

◆ Dictionary

friend class Dictionary
friend

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