Why and when to perform this task
Use this task to add declarations for class variables, constructors, and destructors for a CORBA servant class to its skeleton implementation header file, servant.ih. This defines any private data members for the implementation code in the associated servant_I.cpp file.
This task follows the task to compile the servant.idl file, which defines the public interface for the server implementation class. For more information about compiling the IDL file, which creates the servant.ih file, see Compiling the servant IDL (using idlc).
Steps for this task
Interface declaration in WSLogger.idl | Implementation header in WSLogger.ih |
---|---|
interface WSLogger { void setFileName(in string newFileName); string getFileName(); void setMethodName( in string newMethodName ); string getMethodName(); short openLogFile(); short closeLogFile(); short writeLogMessage(in string newMessage, in short newSeverity); const short DMY_DATE_FORMAT = 1; const short MDY_DATE_FORMAT = 2; void setDateFormat(in unsigned short newDateFormat); unsigned short getDateFormat(); }; |
class WSLogger_Impl : public virtual ::WSLogger_Skeleton { public: ::CORBA::Void setFileName (const char* newFileName); char* getFileName (); ::CORBA::Void setMethodName (const char* newMethodName); char* getMethodName (); ::CORBA::Short openLogFile (); ::CORBA::Short closeLogFile (); ::CORBA::Short writeLogMessage (const char* newMessage, ::CORBA::Short newSeverity); ::CORBA::Void setDateFormat (::CORBA::UShort newDateFormat); ::CORBA::UShort getDateFormat (); private: char * fileName; char * methodName; ::CORBA::UShort dateFormat; ofstream logFile; ::CORBA::UShort logFileOpen; public: WSLogger_Impl( char * newFileName ); virtual ~WSLogger_Impl(); }; |
Results
What to do next
Add code to the skeleton implementation definition, servant_I.cpp, to implement the business logic as described in Completing the server implementation (server_I.cpp).