Creating the String Object
You first need to create the object that will be loaded into the Agent. Here is the code that creates a string object.
 
#include <rwsf/core/NamedObject.h>
#include <rwsf/core/Config.h>
#include <rwsf/core/CString.h>
 
class MyString {
public:
MyString() {}
MyString(const std::string& str) : str_(str) {}
std::string getStr() const {
return str_;
}
 
void init(const rwsf::Config& initParams) {
str_ = initParams.getInitParameter("aString");
}
 
private:
std::string str_;
};
The init() method is required to be in the class that serves as the entry point to your code because the Agent calls this method at startup, passing an rwsf::Config object containing any initialization parameters obtained from the objects.xml file. See Configuring the Named Object.