Fawkes API  Fawkes Development Version
fawkes::CLIPSEnvManager Class Reference

CLIPS environment manager. More...

#include <>>

Public Member Functions

 CLIPSEnvManager (Logger *logger, Clock *clock, std::string &clips_dir)
 Constructor. More...
 
virtual ~CLIPSEnvManager ()
 Destructor. More...
 
LockPtr< CLIPS::Environment > create_env (const std::string &env_name, const std::string &log_component_name)
 Create a new environment. More...
 
void destroy_env (const std::string &env_name)
 Destroy the named environment. More...
 
void add_features (const std::list< CLIPSFeature *> &features)
 Add a feature by name. More...
 
void remove_features (const std::list< CLIPSFeature *> &features)
 Remove a feature by name. More...
 
void assert_can_remove_features (const std::list< CLIPSFeature *> &features)
 Assert that a feature can be removed. More...
 
std::map< std::string, LockPtr< CLIPS::Environment > > environments () const
 Get map of environments. More...
 

Detailed Description

CLIPS environment manager.

The CLIPS environment manager creates and maintains CLIPS environments, registers features and provides them to the CLIPS environments, and allows access to any and all CLIPS environments.

Author
Tim Niemueller

Definition at line 42 of file clips_env_manager.h.

Constructor & Destructor Documentation

◆ CLIPSEnvManager()

fawkes::CLIPSEnvManager::CLIPSEnvManager ( Logger logger,
Clock clock,
std::string &  clips_dir 
)

Constructor.

Parameters
loggerlogger to log messages from created environments
clockclock to get time from for (now)
clips_dirpath where to look for CLIPS files

Definition at line 165 of file clips_env_manager.cpp.

◆ ~CLIPSEnvManager()

fawkes::CLIPSEnvManager::~CLIPSEnvManager ( )
virtual

Destructor.

Definition at line 173 of file clips_env_manager.cpp.

Member Function Documentation

◆ add_features()

void fawkes::CLIPSEnvManager::add_features ( const std::list< CLIPSFeature *> &  features)

Add a feature by name.

Parameters
featuresCLIPS feature maintainers to add

Definition at line 399 of file clips_env_manager.cpp.

Referenced by CLIPSThread::init().

◆ assert_can_remove_features()

void fawkes::CLIPSEnvManager::assert_can_remove_features ( const std::list< CLIPSFeature *> &  features)

Assert that a feature can be removed.

The feature will not actually be removed, it will just be checked if this would work without problem.

Parameters
featureslist of features to query for removal
Exceptions
Exceptionthrown with a descriptive message if the feature cannot be removed because it is still in use

Definition at line 432 of file clips_env_manager.cpp.

◆ create_env()

LockPtr< CLIPS::Environment > fawkes::CLIPSEnvManager::create_env ( const std::string &  env_name,
const std::string &  log_component_name 
)

Create a new environment.

The environment is registered internally under the specified name. It must be destroyed when done with it. Only a single environment can be created for a particular environment name.

Parameters
env_namename by which to register environment
log_component_nameprefix for log entries
Returns
readily initialized CLIPS environment

Definition at line 232 of file clips_env_manager.cpp.

◆ destroy_env()

void fawkes::CLIPSEnvManager::destroy_env ( const std::string &  env_name)

Destroy the named environment.

Only ever destroy environments which you have created yourself.

Parameters
env_namename of the environment to destroy

Definition at line 267 of file clips_env_manager.cpp.

◆ environments()

std::map< std::string, LockPtr< CLIPS::Environment > > fawkes::CLIPSEnvManager::environments ( ) const

Get map of environments.

Returns
map from environment name to environment lock ptr

Definition at line 293 of file clips_env_manager.cpp.

References fawkes::Time::get_sec(), and fawkes::Time::get_usec().

◆ remove_features()

void fawkes::CLIPSEnvManager::remove_features ( const std::list< CLIPSFeature *> &  features)

Remove a feature by name.

Parameters
featureslist of features to remove
Exceptions
Exceptionthrown with a descriptive message if the feature cannot be removed because it is still in use

Definition at line 452 of file clips_env_manager.cpp.


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