Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 01-29-2007
lijb lijb is offline
Registered User
 
Name: lijianbao
Organization: beijingfuyao
Project: No specific project
 
Join Date: Jan 2007
Posts: 2
I have a problem, it has not!

//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_8EB B_B8911B4DB20A__INCLUDED_)
#define AFX_THROUGHPUTI_H__9CE9BCB3_01E4_44EE_8EBB_B8911B4 DB20A__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_8EB B_B8911B4DB20A__INCLUDED_)


////////////////////////
//ThroughputI.cpp
#include "ThroughputI.h"

ThroughputI::ThroughputI() :
_structSeq(server::StringDoubleSeqSize)
{
int i;
for(i = 0; i < server::StringDoubleSeqSize; ++i)
{
_structSeq[i].s = "lijb";
_structSeq[i].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'

Last edited by lijb : 01-29-2007 at 09:55 PM.
Reply With Quote
  #2 (permalink)  
Old 01-29-2007
matthew's Avatar
matthew matthew is online now
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,061
Code:
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.
Reply With Quote
  #3 (permalink)  
Old 01-29-2007
lijb lijb is offline
Registered User
 
Name: lijianbao
Organization: beijingfuyao
Project: No specific project
 
Join Date: Jan 2007
Posts: 2
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!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 12:56 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.