std::ostream & symbol_table::matlabSymbolNamesToOstream( std::ostream & os ) const { for( int i = 0; i < getNumberOfSymbols(); i++ ) { os << "vn(" << ( i+1 ) << ").name = '" << getSymbol( i ) << "';" << std::endl; } return os; }
int MDQuoteConsolidated::serialize(char *buf) { int bytes = 0; UNSIGNED_CHARACTER tmpChar = 0; UNSIGNED_LONG tmpLong = 0; UNSIGNED_SHORT tmpShort = 0; bytes = sizeof(UNSIGNED_SHORT); // Leave 2 bytes for packet size SERIALIZE_8(tmpChar, (UNSIGNED_CHARACTER) (RSP::Responsecategory_MDQuoteConsolidated), buf, bytes); //Response Category SERIALIZE_64(tmpLong, getNumberOfSymbols(), buf, bytes); for(int i=0; i<getNumberOfSymbols(); ++i) { SERIALIZE_64(tmpLong, getSymbolId(i), buf, bytes); SERIALIZE_64(tmpLong, getLastTradePrice(i), buf, bytes); SERIALIZE_64(tmpLong, getLastTradeQty(i), buf, bytes); SERIALIZE_64(tmpLong, getOpenPrice(i), buf, bytes); SERIALIZE_64(tmpLong, getClosePrice(i), buf, bytes); SERIALIZE_64(tmpLong, getHighPrice(i), buf, bytes); SERIALIZE_64(tmpLong, getLowPrice(i), buf, bytes); } SERIALIZE_8(tmpChar, getDepth(), buf, bytes); for(int i=0; i<_numSymbols; ++i) { for(int j=0; j<_depth; ++j) { SERIALIZE_64(tmpLong, _bidPrice[i][j], buf, bytes); SERIALIZE_64(tmpLong, _bidQty[i][j], buf, bytes); SERIALIZE_64(tmpLong, _askPrice[i][j], buf, bytes); SERIALIZE_64(tmpLong, _askQty[i][j], buf, bytes); } } UNSIGNED_SHORT dummyBytes = 0; // Put size as the first field after deducting 2 bytes reserved for size SERIALIZE_16(tmpShort, (UNSIGNED_SHORT)(bytes-sizeof(UNSIGNED_SHORT)), buf, dummyBytes); return bytes; }
void MDQuoteConsolidated::dump() { std::cout << "\nxxxxxxxxxxxxxxxxxxx MDQuote xxxxxxxxxxxxxxxxxxxxxxxx\n" << std::endl; std::cout << "\ngetNumberOfSymbols() " << getNumberOfSymbols(); for(int i=0; i<getNumberOfSymbols(); ++i) { std::cout << "\ngetSymbolId() " << getSymbolId(i); std::cout << "\ngetLastTradePrice() " << getLastTradePrice(i); std::cout << "\ngetLastTradeQty() " << getLastTradeQty(i); std::cout << "\ngetOpenPrice() " << getOpenPrice(i); std::cout << "\ngetClosePrice() " << getClosePrice(i); std::cout << "\ngetHighPrice() " << getHighPrice(i); std::cout << "\ngetLowPrice() " << getLowPrice(i); std::cout << "\ngetDepth() " << (UNSIGNED_INTEGER) getDepth(); std::cout << "\nBidPrice " ; dumpDepth(_bidPrice[i], getDepth()); std::cout << "\nBidQty " ; dumpDepth(_bidQty[i], getDepth()); std::cout << "\nAskPrice " ; dumpDepth(_askPrice[i], getDepth()); std::cout << "\nAskQty " ; dumpDepth(_askQty[i], getDepth()); } std::cout << "\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n" << std::endl; }
ossimNitfSymbolHeader *ossimNitfFileHeaderV2_0::getNewSymbolHeader( ossim_uint32 symbolNumber, std::istream& in)const { ossimNitfSymbolHeader *result = 0; if( (getNumberOfSymbols() > 0) && (symbolNumber < theSymbolOffsetList.size()) ) { result = allocateSymbolHeader(); in.seekg(theSymbolOffsetList[symbolNumber].theSymbolHeaderOffset, std::ios::beg); result->parseStream(in); } return result; }
PacDecoderBuffer( std::string const & filename, ::std::size_t rbuffersize, bool const raddterm = false ) : stream(filename), b(2), n(getNumberOfSymbols(stream)), // smallest multiple aligning to bitsperentity bits alignmult(1ull << (loglog-::libmaus2::bitio::Ctz::ctz(b))), // make buffersize multiple of alignmult buffersize(((rbuffersize + alignmult-1)/alignmult)*alignmult), C((buffersize*b+7)/8), buffer(buffersize,false), symsread(0), addterm(raddterm) { setg(buffer.end(), buffer.end(), buffer.end()); }
MDQuoteConsolidated::MDQuoteConsolidated(const char* buf) //deserializing { int offset = 0; UNSIGNED_CHARACTER tmpChar = 0; UNSIGNED_LONG tmpLong1 = 0, tmpLong2 = 0; DESERIALIZE_64(tmpLong1, tmpLong2, setNumberOfSymbols(tmpLong2), buf, offset); for(int i=0; i<getNumberOfSymbols(); ++i) { DESERIALIZE_64(tmpLong1, tmpLong2, setSymbolId(i, tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setLastTradePrice(i, tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setLastTradeQty(i, tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setOpenPrice(i, tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setClosePrice(i, tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setHighPrice(i, tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setLowPrice(i, tmpLong2), buf, offset); } DESERIALIZE_8(tmpChar, setDepth(tmpChar), buf, offset); _bidPrice.resize(_numSymbols); _bidQty.resize(_numSymbols); _askPrice.resize(_numSymbols); _askQty.resize(_numSymbols); for(int i=0; i<_numSymbols; ++i) { _bidPrice[i].resize(_depth); _bidQty[i].resize(_depth); _askPrice[i].resize(_depth); _askQty[i].resize(_depth); } for(int i=0; i<_numSymbols; ++i) { for(int j=0; j<_depth; ++j) { DESERIALIZE_64(tmpLong1, tmpLong2, _bidPrice[i][j]=tmpLong2, buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, _bidQty[i][j]=tmpLong2, buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, _askPrice[i][j]=tmpLong2, buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, _askQty[i][j]=tmpLong2, buf, offset); } } }
bool ossimNitfFileHeader::hasSymbols()const { return (getNumberOfSymbols() > 0); }