Page MenuHomec4science

Config.h
No OneTemporary

File Metadata

Created
Mon, Dec 2, 14:01

Config.h

/**
* \file Config.h
*
* \date Sep 25, 2012
* \author Alexandre Tuleu
*/
#ifndef LIBSBCP_CONFIG_H_
#define LIBSBCP_CONFIG_H_
#include <libatuleu/base/Singleton.h>
#include <libatuleu/options/Option.h>
#include <libsbcp/bus/Bus.h>
#define ADD_OPTION_IMPLEMENTATION(name,type) \
private:\
options::Option<type>::Ptr d_o ## name;\
public:\
inline const type & name () const { return d_o ## name ->Value(); }
/**
*
*/
namespace sbcp{
class SbcpConfig {
public :
SbcpConfig(options::Section::Ptr base);
ADD_OPTION_IMPLEMENTATION(Baudrate,unsigned int)
ADD_OPTION_IMPLEMENTATION(Interface,unsigned int)
ADD_OPTION_IMPLEMENTATION(Latency,unsigned int)
ADD_OPTION_IMPLEMENTATION(SerialType, std::string)
ADD_OPTION_IMPLEMENTATION(DevName, std::string)
};
/**
*
*/
class Config : public LazySingleton<Config>{
public:
Config();
virtual ~Config();
std::tr1::shared_ptr<Bus> CreateBusFromStdFile();
const SbcpConfig & Sbcp() const;
private:
void LoadFromStdFiles();
options::Section::Ptr d_root;
SbcpConfig d_config;
const static char * BaseFileName;
};
}
#endif // LIBSBCP_CONFIG_H_

Event Timeline