Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93927688
Config.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Dec 2, 14:01
Size
1 KB
Mime Type
text/x-c++
Expires
Wed, Dec 4, 14:01 (2 d)
Engine
blob
Format
Raw Data
Handle
22723077
Attached To
R6621 SBCP High-Level Driver
Config.h
View Options
/**
* \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
Log In to Comment