Archived
This forum has been archived. Please start a new discussion on GitHub.
I have a problem, it has not!
in Help Center
//ServerICE.h
#ifndef SERVER_1_ICE
#define SERVER_1_ICE
module server
{
struct StringDouble
{
string s;
double d;
};
sequence StringDoubleSeq;
const int StringDoubleSeqSize = 50000;
interface Throughput
{
void sendStructSeq(StringDoubleSeq seq);
StringDoubleSeq recvStructSeq();
StringDoubleSeq echoStructSeq();
void a1();
void a2(string tStr);
void a3(StringDoubleSeq tStrDou);
void a4(out string tStr);
void a5(out StringDoubleSeq tStrDou);
// idempotent void shutdown();
};
};
#endif
/////////////////////
//ThroughputI.h
#if !defined(AFX_THROUGHPUTI_H__9CE9BCB3_01E4_44EE_8EBB_B8911B4DB20A__INCLUDED_)
#define AFX_THROUGHPUTI_H__9CE9BCB3_01E4_44EE_8EBB_B8911B4DB20A__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "ServerICE.h"
using namespace std;
class ThroughputI : public server::Throughput
{
public:
ThroughputI();
virtual void sendStructSeq(const server::StringDoubleSeq &tstructSeq, const Ice::Current&);
virtual server::StringDoubleSeq recvStructSeq(const Ice::Current&);
virtual server::StringDoubleSeq echoStructSeq(const Ice::Current&);
virtual void a1(const ::Ice::Context&);
virtual void a2(const ::std::string &tStr, const ::Ice::Context&);
virtual void a3(const ::server::StringDoubleSeq &tStrDou, const ::Ice::Context&);
virtual void a4(::std::string &tStr, const ::Ice::Context&);
virtual void a5(::server::StringDoubleSeq &tStrDou, const ::Ice::Context&);
private:
server::StringDoubleSeq _structSeq;
};
#endif // !defined(AFX_THROUGHPUTI_H__9CE9BCB3_01E4_44EE_8EBB_B8911B4DB20A__INCLUDED_)
////////////////////////
//ThroughputI.cpp
#include "ThroughputI.h"
ThroughputI::ThroughputI() :
_structSeq(server::StringDoubleSeqSize)
{
int i;
for(i = 0; i < server::StringDoubleSeqSize; ++i)
{
_structSeq.s = "lijb";
_structSeq.d = 3.14;
}
}
void
ThroughputI::sendStructSeq(const server::StringDoubleSeq &tstructSeq, const Ice::Current&)
{
_structSeq = tstructSeq;
}
server::StringDoubleSeq
ThroughputI::recvStructSeq(const Ice::Current&)
{
return _structSeq;
}
server::StringDoubleSeq
ThroughputI::echoStructSeq(const Ice::Current&)//string& tstring,
{
return _structSeq;
}
void ThroughputI::a1(const ::Ice::Context&)
{
}
void ThroughputI::a2(const ::std::string &tStr, const ::Ice::Context&)
{
}
void ThroughputI::a3(const ::server::StringDoubleSeq &tStrDou, const ::Ice::Context&)
{
}
void ThroughputI::a4(::std::string &tStr, const ::Ice::Context&)
{
}
void ThroughputI::a5(::server::StringDoubleSeq &tStrDou, const ::Ice::Context&)
{
}
////////////////
//server1.cpp
#include "ThroughputI.h"
#include <Ice/Application.h>
#include <Ice/Service.h>
using namespace std;
class ThroughputServer : public Ice::Application
{
public:
virtual int run(int, char*[]);
};
int
main(int argc, char* argv[])
{
ThroughputServer app;
return app.main(argc, argv, "config.server");
}
int
ThroughputServer::run(int argc, char* argv[])
{
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Throughput");
adapter->add(new ThroughputI, communicator()->stringToIdentity("throughput"));
adapter->activate();
communicator()->waitForShutdown();
return EXIT_SUCCESS;
}
Compiler error!
d:\test\ice\work\server1\server1.cpp(36) : error C2259: 'ThroughputI' : cannot instantiate abstract class due to following members:
d:\test\ice\work\server1\throughputi.h(15) : see declaration of 'ThroughputI'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a1(const struct Ice::Current &)' : pure virtual function was not defined
d:\test\ice\work\server1\serverice.h(322) : see declaration of 'a1'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a2(const class _STL::basic_string,class _STL::allocator > &,const struct Ice::Current &)' : pure virtual function
was not defined
d:\test\ice\work\server1\serverice.h(325) : see declaration of 'a2'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a3(const class _STL::vector > &,const struct Ice::Current &)' : pure virtua
l function was not defined
d:\test\ice\work\server1\serverice.h(328) : see declaration of 'a3'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a4(class _STL::basic_string,class _STL::allocator > &,const struct Ice::Current &)' : pure virtual function was n
ot defined
d:\test\ice\work\server1\serverice.h(331) : see declaration of 'a4'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a5(class _STL::vector > &,const struct Ice::Current &)' : pure virtual func
tion was not defined
d:\test\ice\work\server1\serverice.h(334) : see declaration of 'a5'
d:\test\ice\work\server1\server1.cpp(36) : error C2259: 'ThroughputI' : cannot instantiate abstract class due to following members:
d:\test\ice\work\server1\throughputi.h(15) : see declaration of 'ThroughputI'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a1(const struct Ice::Current &)' : pure virtual function was not defined
d:\test\ice\work\server1\serverice.h(322) : see declaration of 'a1'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a2(const class _STL::basic_string,class _STL::allocator > &,const struct Ice::Current &)' : pure virtual function
was not defined
d:\test\ice\work\server1\serverice.h(325) : see declaration of 'a2'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a3(const class _STL::vector > &,const struct Ice::Current &)' : pure virtua
l function was not defined
d:\test\ice\work\server1\serverice.h(328) : see declaration of 'a3'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a4(class _STL::basic_string,class _STL::allocator > &,const struct Ice::Current &)' : pure virtual function was n
ot defined
d:\test\ice\work\server1\serverice.h(331) : see declaration of 'a4'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a5(class _STL::vector > &,const struct Ice::Current &)' : pure virtual func
tion was not defined
d:\test\ice\work\server1\serverice.h(334) : see declaration of 'a5'
#ifndef SERVER_1_ICE
#define SERVER_1_ICE
module server
{
struct StringDouble
{
string s;
double d;
};
sequence StringDoubleSeq;
const int StringDoubleSeqSize = 50000;
interface Throughput
{
void sendStructSeq(StringDoubleSeq seq);
StringDoubleSeq recvStructSeq();
StringDoubleSeq echoStructSeq();
void a1();
void a2(string tStr);
void a3(StringDoubleSeq tStrDou);
void a4(out string tStr);
void a5(out StringDoubleSeq tStrDou);
// idempotent void shutdown();
};
};
#endif
/////////////////////
//ThroughputI.h
#if !defined(AFX_THROUGHPUTI_H__9CE9BCB3_01E4_44EE_8EBB_B8911B4DB20A__INCLUDED_)
#define AFX_THROUGHPUTI_H__9CE9BCB3_01E4_44EE_8EBB_B8911B4DB20A__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "ServerICE.h"
using namespace std;
class ThroughputI : public server::Throughput
{
public:
ThroughputI();
virtual void sendStructSeq(const server::StringDoubleSeq &tstructSeq, const Ice::Current&);
virtual server::StringDoubleSeq recvStructSeq(const Ice::Current&);
virtual server::StringDoubleSeq echoStructSeq(const Ice::Current&);
virtual void a1(const ::Ice::Context&);
virtual void a2(const ::std::string &tStr, const ::Ice::Context&);
virtual void a3(const ::server::StringDoubleSeq &tStrDou, const ::Ice::Context&);
virtual void a4(::std::string &tStr, const ::Ice::Context&);
virtual void a5(::server::StringDoubleSeq &tStrDou, const ::Ice::Context&);
private:
server::StringDoubleSeq _structSeq;
};
#endif // !defined(AFX_THROUGHPUTI_H__9CE9BCB3_01E4_44EE_8EBB_B8911B4DB20A__INCLUDED_)
////////////////////////
//ThroughputI.cpp
#include "ThroughputI.h"
ThroughputI::ThroughputI() :
_structSeq(server::StringDoubleSeqSize)
{
int i;
for(i = 0; i < server::StringDoubleSeqSize; ++i)
{
_structSeq.s = "lijb";
_structSeq.d = 3.14;
}
}
void
ThroughputI::sendStructSeq(const server::StringDoubleSeq &tstructSeq, const Ice::Current&)
{
_structSeq = tstructSeq;
}
server::StringDoubleSeq
ThroughputI::recvStructSeq(const Ice::Current&)
{
return _structSeq;
}
server::StringDoubleSeq
ThroughputI::echoStructSeq(const Ice::Current&)//string& tstring,
{
return _structSeq;
}
void ThroughputI::a1(const ::Ice::Context&)
{
}
void ThroughputI::a2(const ::std::string &tStr, const ::Ice::Context&)
{
}
void ThroughputI::a3(const ::server::StringDoubleSeq &tStrDou, const ::Ice::Context&)
{
}
void ThroughputI::a4(::std::string &tStr, const ::Ice::Context&)
{
}
void ThroughputI::a5(::server::StringDoubleSeq &tStrDou, const ::Ice::Context&)
{
}
////////////////
//server1.cpp
#include "ThroughputI.h"
#include <Ice/Application.h>
#include <Ice/Service.h>
using namespace std;
class ThroughputServer : public Ice::Application
{
public:
virtual int run(int, char*[]);
};
int
main(int argc, char* argv[])
{
ThroughputServer app;
return app.main(argc, argv, "config.server");
}
int
ThroughputServer::run(int argc, char* argv[])
{
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Throughput");
adapter->add(new ThroughputI, communicator()->stringToIdentity("throughput"));
adapter->activate();
communicator()->waitForShutdown();
return EXIT_SUCCESS;
}
Compiler error!
d:\test\ice\work\server1\server1.cpp(36) : error C2259: 'ThroughputI' : cannot instantiate abstract class due to following members:
d:\test\ice\work\server1\throughputi.h(15) : see declaration of 'ThroughputI'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a1(const struct Ice::Current &)' : pure virtual function was not defined
d:\test\ice\work\server1\serverice.h(322) : see declaration of 'a1'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a2(const class _STL::basic_string,class _STL::allocator > &,const struct Ice::Current &)' : pure virtual function
was not defined
d:\test\ice\work\server1\serverice.h(325) : see declaration of 'a2'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a3(const class _STL::vector > &,const struct Ice::Current &)' : pure virtua
l function was not defined
d:\test\ice\work\server1\serverice.h(328) : see declaration of 'a3'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a4(class _STL::basic_string,class _STL::allocator > &,const struct Ice::Current &)' : pure virtual function was n
ot defined
d:\test\ice\work\server1\serverice.h(331) : see declaration of 'a4'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a5(class _STL::vector > &,const struct Ice::Current &)' : pure virtual func
tion was not defined
d:\test\ice\work\server1\serverice.h(334) : see declaration of 'a5'
d:\test\ice\work\server1\server1.cpp(36) : error C2259: 'ThroughputI' : cannot instantiate abstract class due to following members:
d:\test\ice\work\server1\throughputi.h(15) : see declaration of 'ThroughputI'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a1(const struct Ice::Current &)' : pure virtual function was not defined
d:\test\ice\work\server1\serverice.h(322) : see declaration of 'a1'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a2(const class _STL::basic_string,class _STL::allocator > &,const struct Ice::Current &)' : pure virtual function
was not defined
d:\test\ice\work\server1\serverice.h(325) : see declaration of 'a2'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a3(const class _STL::vector > &,const struct Ice::Current &)' : pure virtua
l function was not defined
d:\test\ice\work\server1\serverice.h(328) : see declaration of 'a3'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a4(class _STL::basic_string,class _STL::allocator > &,const struct Ice::Current &)' : pure virtual function was n
ot defined
d:\test\ice\work\server1\serverice.h(331) : see declaration of 'a4'
d:\test\ice\work\server1\server1.cpp(36) : warning C4259: 'void __thiscall server::Throughput::a5(class _STL::vector > &,const struct Ice::Current &)' : pure virtual func
tion was not defined
d:\test\ice\work\server1\serverice.h(334) : see declaration of 'a5'
0
Comments
-
virtual void a1(const ::Ice::Context&); virtual void a2(const ::std::string &tStr, const ::Ice::Context&); virtual void a3(const ::server::StringDoubleSeq &tStrDou, const ::Ice::Context&); virtual void a4(::std::string &tStr, const ::Ice::Context&); virtual void a5(::server::StringDoubleSeq &tStrDou, const ::Ice::Context&);
This is incorrect. The last parameter is Ice::Current, not Ice::Context. I would suggest using the --impl option of the slice2cpp compiler to generate a sample implementation to see what the correct method signatures are.0 -
Thank you for your answer!
I am a beginner, this is my frist ICE test Code.
Thank you for your answer!
I will Study hard!0