HydraExpress™ C++ API Reference Guide

 
Loading...
Searching...
No Matches
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

◆ NamingContext()

rwsf::NamingContext::NamingContext ( )

Default constructor.

◆ ~NamingContext()

rwsf::NamingContext::~NamingContext ( )

Destructor.

Member Function Documentation

◆ bind()

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.

◆ getGlobalInstance()

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.

◆ listBindings()

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

Returns an enumeration of the names in this context.

◆ load()

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.

◆ loadGlobal()

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.

◆ lookup()

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).

◆ unbind()

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

Removes this named object from the context.

Copyright © 2026 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.