How to make my parameter Configurable by taking its value from config file?

Example:

ifstream ricFile("E:\\RicCodeFile.txt");

string ricCode;

OmmArray ricArray;

// read RICS from file into Array

if (ricFile.is_open())

{

while (getline(ricFile, ricCode)) ricArray.addAscii(ricCode.c_str()); ricArray.complete();

ricFile.close();

}

// Encode array into ReqMsg

UInt64 handle = consumer.registerClient( ReqMsg() .serviceName( "IDN_SELECTFEED" ) .payload( ElementList().addArray( ":ItemList", ricArray ).complete() ).interestAfterRefresh(true), client );

---------------------------

Currently I am hard coding file path, service Name, but I want to make it configurable using config file. please help..

Best Answer

  • @nishikarale

    As far as I know, currently EMA C++ does not provide interface to read custom configuration from EMA configuration file.

    You have to implementation your own configuration using text file or set your config in your application config using xml or json file and then use 3rd party C++ lib to read the file. Other solution might be environment variable which you can read the value from your application using getenv() from standard library. But you have to set the environment variable when you install the application on the new machine.