[omniORB] abstract class

Wernke Zur Borg (external) wernke.zur.borg at external.vega.de
Thu Mar 5 08:05:15 GMT 2009


 

> -----Original Message-----
> From: omniorb-list-bounces at omniorb-support.com 
> Of Marek Cichy
> Sent: 04 March 2009 21:22
> To: omniorb-list at omniorb-support.com
> Subject: [omniORB] abstract class
> 
> Hi list
> My problem: I have succesfully compiled my idl file, included .hh and 
> .cc files into project and defined interface functions. When 
> I compile 
> the project I get an error " C2259: 'Simple_impl' : cannot 
> instantiate 
> abstract class". I compared my project with few examples and 
> everything 
> seems to be written properly. Below I listed .idl file and 
> implementations of interface functions. Can someone give me 
> some help? I 
> try to create object in a following way:
> 
> Simple_impl* simple_servant = new Simple_impl();
> 
> My SW:
> OS: WXP SP3
> ORB: omniORB 4.1.2
> IDE: VS2008
> 
> ITestServer.idl:
> -------------------------------------------------------
> #ifndef _ITEST_SERVER_
> #define _ITEST_SERVER_
> 
> module ITestServer {
>     typedef char ct [1000];
>     typedef double dt [1000]; 
>    
>     interface ISimple {
>       char _get_char(in unsigned short _index);
>       double _get_double(in unsigned short _index);
>       void _set_char(in char c,in unsigned short _index);
>       void _set_double(in double d,in unsigned short _index);
>     };
>     interface IComplex { 
>       void _get_char_table(inout ct _char_table);
>       void _get_double_table(inout dt _double_table);
>       void _fill_char_table(in ct _char_table);
>       void _fill_double_table(in dt _double_table);
>     };
> };
> #endif  // _ITEST_SERVER_
> ------------------------------------------------------
> functions declarations:
> ------------------------------------------------------
> #include "ITestServer.h"
> 
> class Simple_impl : public virtual POA_ITestServer::ISimple
> {
> private:
>     char tc[1000];
>     double td[1000];
> public:
>     Simple_impl();
> public:
>     virtual char _get_char(unsigned short _index) 
> throw(CORBA::SystemException);
>     virtual double _get_double(unsigned short _index) 
> throw(CORBA::SystemException);
>     virtual void _set_char(char c, unsigned short _index) 
> throw(CORBA::SystemException);
>     virtual void _set_double(double d, unsigned short _index) 
> throw(CORBA::SystemException);
> };
> 
> class Complex_impl : public virtual POA_ITestServer::IComplex
> {
> private:
>     char tc[1000];
>     double td[1000];
> public:
>     Complex_impl();
> public:
>     virtual void _get_char_table(char _char_table[]) 
> throw(CORBA::SystemException);
>     virtual void _get_double_table(double _double_table[]) 
> throw(CORBA::SystemException);
>     virtual void _set_char_table(char _char_table[]) 
> throw(CORBA::SystemException);
>     virtual void _set_double_table(double _double_table[]) 
> throw(CORBA::SystemException);
> };
> -------------------------------------------------
> functions definitions:
> -------------------------------------------------
> #include "server.h"
> 
> Simple_impl::Simple_impl()
> {
>     for (int i=0;i<1000;i++)
>         this->tc[i]='s';
>     for (int i=0;i<1000;i++)
>         this->td[i]=3.14;
> };
> char Simple_impl::_get_char(unsigned short _index) 
> throw(CORBA::SystemException)
> {
>     return this->tc[_index];
> };
> double Simple_impl::_get_double(unsigned short _index) 
> throw(CORBA::SystemException)
> {
>     return this->td[_index];
> };
> void Simple_impl::_set_char(char c,unsigned short _index) 
> throw(CORBA::SystemException)
> {
>     this->tc[_index]=c;
> };
> void Simple_impl::_set_double(double d,unsigned short _index) 
> throw(CORBA::SystemException)
> {
>     this->td[_index]=d;
> };
> P.S.
> At least could someone give any sign of life? I receive only 
> answers for 
> other's questions.
> 

Hi Marek,

I can't see any obvious mistake, but as a hint, use the -Wbexample
option of the IDL compiler to generate an example implementation file
ITestServer_i.cc with correct signatures, where you only need to insert
your function body code.

Regards, Wernke



More information about the omniORB-list mailing list