Thanks Jim for your response,
The code is pretty big, however I am posting all the relevant section. There are 3 code sections, header file, class file (which represent the definition of the header file) and finally the client file.
if you look at the last code section which is the client, I am trying to convert the Timestamp variable to a string inside the function "onTrade"
Header file definition
[file]System.h[/file]
Code:
namespace test1 {
class SessionManager;
class SystemApi {
public:
typedef unsigned int Timestamp;
virtual void onTradeTick(std::string symbol, int size, double price, int totalVolume, std::string
exchangeId, std::string quoteSource, Timestamp timestamp, std::string tradeType);
struct Trade
{
uint32_t symbolIndex;
uint32_t size;
int32_t priceMantissa;
int8_t priceExponent;
uint32_t totalVolume;
std::string exchangeId;
std::string quoteSource;
uint32_t timestamp;
std::string tradeType;
char tradeProperties[4];
uint32_t tradeId;
bool isHigh;
bool isLow;
bool isCancelled;
bool isCorrected;
bool isPreviousSessionLastTrade;
};
virtual void onTrade(const Trade& trade);
}
}
class file
[file] System.cc[/file]
Code:
void test1::SystemApi::onTradeTick(std::string symbol,
int size,
double price,
int totalVolume,
std::string exchangeId,
std::string quoteSource,
Timestamp timestamp,
std::string tradeType)
{
}
void test1::SystemApi::onTrade(const Trade& trade)
{
onTradeTick(getSymbol(trade.symbolIndex),
trade.size,
priceToDouble(trade.priceMantissa, trade.priceExponent),
trade.totalVolume,
trade.exchangeId,
trade.quoteSource,
trade.timestamp,
trade.tradeType);
}
client file.
[file]SystemClient.cc[/file]
Code:
class SystemApiClientDemo : public SystemApi {
public:
void onTrade(const Trade &trade);
void onTradeTick(std::string symbol,
int size,
double price,
int totalVolume,
std::string exchangeId,
std::string quoteSource,
Timestamp timestamp,
std::string tradeType);
}
void SystemApiClientDemo::onTrade(const Trade &trade)
{
std::string symbol;
map<int, std::string>::const_iterator searchResult = symbolIndexToName.find(trade.symbolIndex);
if (searchResult != symbolIndexToName.end())
symbol = symbolIndexToName[trade.symbolIndex];
int size = trade.size;
double price = trade.priceMantissa * (double)pow(10.0, trade.priceExponent);
long totalVolume = trade.totalVolume;
std::string exchangeId = trade.exchangeId;
std::string quoteSource = trade.quoteSource;
Timestamp timestamp = trade.timestamp;
std::string tradeType = trade.tradeType;
if(!printQuotes) return;
std::cout << "onTradeTick: symbol = " << symbol
<< ", size = " << size
<< ", price = " << std::showpoint << std::fixed << std::setprecision(4) << price
<< ", totalVolume = " << totalVolume
<< ", exchangeId = " << exchangeId
<< ", quoteSource = " << quoteSource
<< ", timestamp = " << timestamp
<< ", tradeType = " << tradeType
<< std::endl;
}
//This is where I am trying to convert the timestamp to a string