HydraExpress™ C++ API Reference Guide

Product Documentation:
   HydraExpress C++
Documentation Home
List of all members | Public Member Functions | Static Public Member Functions
rwsf::NamingContext Class Reference

Contains all NamedObject instances for a service, acting like a global registry and instantiating each object at startup. More...

#include <rwsf/core/NamingContext.h>

Public Member Functions

 NamingContext ()
 
 ~NamingContext ()
 
void bind (const std::string &name, const rwsf::NamedObject &obj)
 
rwsf::Enumeration< std::string > listBindings () const
 
void load (const std::string &filename, const std::string &librarySuffix=std::string(RWSF_DEFAULT_LIBSUFFIX))
 
rwsf::NamedObject lookup (const std::string &name) const
 
void unbind (const std::string &name)
 

Static Public Member Functions

static NamingContextgetGlobalInstance ()
 
static void loadGlobal (const std::string &filename, const std::string &librarySuffix=std::string(RWSF_DEFAULT_LIBSUFFIX))
 

Detailed Description

A rwsf::NamingContext object contains all rwsf::NamedObject instances relevant to a particular service. On startup, the Agent creates all registered named objects and then stores them together in an instance of rwsf::NamingContext specific to each service. This context object acts like a global registry and instantiates each object.

See the class description for rwsf::NamedObject for detail on how to create or edit named object configuration files so that named objects are properly loaded at startup, and how NamedObject instances are used in the system.

Constructor & Destructor Documentation

rwsf::NamingContext::NamingContext ( )

Default constructor.

rwsf::NamingContext::~NamingContext ( )

Destructor.

Member Function Documentation

void rwsf::NamingContext::bind ( const std::string &  name,
const rwsf::NamedObject obj 
)

Adds name to the NamingContext map, mapped to obj. If name already exists, throws an rwsf::NamingException.

Exceptions
rwsf::NamingExceptionName already exists in map.
static NamingContext* rwsf::NamingContext::getGlobalInstance ( )
static

Returns the global instance of the naming context. If a naming context does not exist, creates a new NamingContext instance.

rwsf::Enumeration<std::string> rwsf::NamingContext::listBindings ( ) const

Returns an enumeration of the names in this context.

void rwsf::NamingContext::load ( const std::string &  filename,
const std::string &  librarySuffix = std::string(RWSF_DEFAULT_LIBSUFFIX) 
)

Reads in an object configuration file and registers the named objects with this naming context instance. See rwsf::NamedObject for information on the format of the configuration file.

Exceptions
rwsf::FileNotFoundExceptionSpecified configuration file filename not found.
static void rwsf::NamingContext::loadGlobal ( const std::string &  filename,
const std::string &  librarySuffix = std::string(RWSF_DEFAULT_LIBSUFFIX) 
)
static

Reads in an object configuration file and registers the named objects with the global naming context. See rwsf::NamedObject for information on the format of the configuration file.

Exceptions
rwsf::FileNotFoundExceptionSpecified configuration file filename not found.
rwsf::NamedObject rwsf::NamingContext::lookup ( const std::string &  name) const

Returns the rwsf::NamedObject associated with name. If name isn't found in the map, an invalid NamedObject is returned (ie. an object where isValid() returns false).

void rwsf::NamingContext::unbind ( const std::string &  name)

Removes this named object from the context.

Copyright © 2020 Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is registered trademark of Rogue Wave Software, Inc. in the United States and other countries, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.