Hi Gurus,
Here i have pasted the sample code( i could n't paste the entire code ). when i compiled the code, i got the errorFollowing is the code snippet:HTML Code:"../TalhAggrApp.C(291) : error C2440: 'initializing' : cannot convert from 'unsig ned int (__thiscall talhAggrSchema::*)(void)' to 'unsigned int' Conversion is a valid standard conversion, which can be performed implic itly or by use of static_cast, C-style cast or function-style cast"
Headerfile
Source FileCode:namespace environment { // now we are talking about long long (64 bits) integers. typedef long int int8; typedef unsigned long int uint8; typedef int int4; typedef unsigned int uint4; typedef short int int2; typedef unsigned short int uint2; typedef signed char int1; typedef unsigned } using namespace environment; class talhAggrSchema { uint4 elementID; uint4 machineID; uint4 taGroupID; uint4 taProtoID; uint4 taTosID; eDirection taDirection; string souceAddr_List[50]; //consider of having vector of Addr_List instead of Array string dstAddr_List[50]; //consider of having vector of Addr_List instead of Array string addr_List[50]; uint4 proto_number; uint4 tos; public: talhAggrSchema():elementID(0), machineID(0), taGroupID(0), taProtoID(0), taTosID(0), taDirection(static_cast<eDirection>(UNKNOWN)), proto_number(0), tos(0) { //todo: ganad01 initialize the addr_List } ~talhAggrSchema() { } uint4 getelementID(void) { return elementID; } void setelementID(uint4 elemID) {elementID = elemID;} uint4 getMachineID(void) { return machineID; } void setMachineID(uint4 mID) { machineID = mID;} uint4 getGroupID(void) { return taGroupID; } void setGroupID(uint4 grpID) { taGroupID = grpID; } uint4 getProtoID(void) {return taProtoID; } void setProtoID(uint4 proID) { taProtoID = proID; } void setAddList(talhAggrSchema& record, uint4 viewID, uint4 groupID) {} uint4 getTosID(void) { return taTosID; } void setTosID(uint4 tosID) { taTosID = tosID; } uint4 getDirection(void) { return taDirection; } void setDirection( eDirection dir ) { taDirection = dir; } uint4 getProtocol(void) { return proto_number; } void setProNumber(uint4 proNum) { proto_number = proNum; } uint4 getTOS(void) { return tos; } void setTos(uint4 tos ) { tos = tos;} }; typedef vector<talhAggrSchema*> VaggrSchemas; class MultiAggregation { //holds different aggregation requests read from NH_ELEMENT VaggrSchemas aggrSchemaCache; //Local cache that holds the raw table content //VRawRecord rawRecordCache; //Local Cache that stores aggregated data, Live Ex expected format VProcessedDataCache aggregationCache; DuConnection &conn; MultiAggregation() {} public: MultiAggregation(DuConnection &connection):conn(connection) { } ~MultiAggregation() { } bool setupAllAggrSchemas( void ); bool setProtocol(talhAggrSchema *as); };
can you please help me to understand the cause of error and to eliminate the error.Code://header file is included using namespace environment; bool MultiAggregation::setupAllAggrSchemas( void ) { pAggrSchema = new talhAggrSchema(); setProtocol(pAggrSchema); } bool MultiAggregation::setProtocol(talhAggrSchema *as) { //DuConnection& conn = DuDatabase::singleInstance ()->getConnection (); todo: ganad01 remove this line DuStatement* stmt = conn.createStatement (); DuResultSet* rs; char query[MAX_QUERY_LENGTH]; uint4 protoID = as->getProtoID; \\error:2440 snprintf(query, MAX_QUERY_LENGTH, "SELECT proto_number FROM %s WHERE proto_id != %d", "NH_PROTCOL" ,protoID ); stmt->setSQL (query); // global::pLog->debug( "setProtocol::Reading NH_PROTCOL" ); Bool result = stmt->executeSQL (DuStatement::DuAutoAlloc, &rs, 1000); CuAssertMsg (result, query); bool success = false; success = getRecordFromResultSet(rs, as, 1); if (!success) { // todo: ganad01 issue a warning about a failed record return false; } return true; } //setProtocol




Reply With Quote