1 #ifndef api2_UserParams_h
2 #define api2_UserParams_h
3 #include <baseCommands.h>
4 #include <sgDebugLog.h>
13 UserParamsError_KeyNotFound,
14 UserParamsError_DataTypeMismatch
25 std::map<std::string,BaseType *> _userParams;
30 CREATE_FIELD_DERIVED(
int, ApiIndex);
39 UserParams(
const std::string &frontendDesign,
const char *buf = NULL);
57 UserParamsError
setValue(
const std::string &key,
const T &val)
59 std::map<std::string,BaseType *>::iterator it = _userParams.find(key);
60 if(it == _userParams.end())
62 std::cout<<
"Key not found : "<<key;
64 return UserParamsError_KeyNotFound;
71 std::cout<<
"Data Type Mismatch for "
76 return UserParamsError_DataTypeMismatch;
81 return UserParamsError_OK;
94 UserParamsError
getValue(
const std::string &key,T &val)
96 std::map<std::string,BaseType *>::iterator it = _userParams.find(key);
97 if(it == _userParams.end())
99 return UserParamsError_KeyNotFound;
106 std::cout<<
"Data Type Mismatch for "<<key<<std::endl;
107 return UserParamsError_DataTypeMismatch;
111 val = value->getValue();
112 return UserParamsError_OK;
int serialize(char *buf, int apiIndex)
serialize
The API2_UserParams class.
Definition: api2UserCommands.h:20
UserParamsError setValue(const std::string &key, const T &val)
setValue
Definition: api2UserCommands.h:57
UserParamsError getValue(const std::string &key, T &val)
getValue
Definition: api2UserCommands.h:94
The AbstractUserParams class.
Definition: baseCommands.h:278
UserParams(const std::string &frontendDesign, const char *buf=NULL)
API2_UserParams.
The DerivedType class.
Definition: baseCommands.h:79