Main Page Class Hierarchy Compound List File List Compound Members File Members

# magnserverrequest.h

Go to the documentation of this file.

    00001 // magnserverrequest.h: interface for the ServerMagnitudeRequest class.
    00002 //
    00004
    00005 #if !defined(MAGNSERVERREQUEST_H)
    00006 #define MAGNSERVERREQUEST_H
    00007
    00008 #if _MSC_VER > 1000
    00009 #pragma once
    00010 #endif // _MSC_VER > 1000
    00011
    00012 #include "mutableserverrequest.h"
    00013
    00014 class ServerMagnitudeRequest : public MutableServerRequest
    00015 {
    00016 protected:
    00017
    00018
    00019    // ----------------------------------------------------------
    00020    //     virtual methods from MutableServerMessage
    00021    //     to be implemented for a complete derivative classes
    00022    // ----------------------------------------------------------
    00023
    00024    // BufferInitAlloc -- when preparing to format a message
    00025    //                    using FormatBuffer()], this is
    00026    //                    first called.  The result is,
    00027    //                    for the first call, MessageBuffer
    00028    //                    will be assured to be at least this
    00029    //                    long.
    00030    //                    Overriding this method allows
    00031    //                    derivative classes to minimize
    00032    //                    reallocations as bits are appended
    00033    //                    to the message buffer;
    00034    //
    00035    // NOTE: In each derivative implementation,
    00036    //       call <super_class>::BufferInitAlloc() to get the
    00037    //       space needed by that super class (and all baser
    00038    //       classes), then add the size needed by the
    00039    //       derivative to arrive at the total size needed.
    00040    //       The 10 specified here is for the message-
    00041    //       terminating '\n' and a slight overrun space.
    00042    //
    00043    long BufferInitAlloc();
    00044
    00045
    00046    // FormatDerivativeData
    00047    //
    00048    //     Method by which derivative classes append
    00049    //     their content to MessageBuffer.
    00050    //
    00051    //  NOTE: ALWAYS CALL <super_class>::FormatDerivativeData()
    00052    //        at the start of each implementation to allow
    00053    //        base classes to append their stuff (if any)
    00054    //        to the buffer.
    00055    //        Thus the buffer is built up from the base-most class.
    00056    //
    00057    // THROW worm_exception for errors
    00058    //
    00059    void FormatDerivativeData();
    00060
    00061
    00062    // ParseDerivativeData
    00063    //
    00064    //     Method by which derivative classes extract
    00065    //     their content to MessageBuffer.
    00066    //
    00067    //  NOTE: Always call <super_class>::ParseDerivativeData()
    00068    //        at the top of each implementation to allow
    00069    //        base classes to get their data out of the
    00070    //        buffer first.
    00071    //
    00072    //  USAGE:
    00073    //
    00074    //     If parsing a multi-line message ('\n'-terminated lines),
    00075    //     use a loop consisting of:
    00076    //
    00077    //       i = MessageBuffer.find("\n")  to find the first line end,
    00078    //       MessageBuffer.substr(0, i)    to extract the string
    00079    //                                        (excluding the '\n')
    00080    //       MessageBuffer.erase(0, i+1)     to remove that portion
    00081    //
    00082    //     Since the message should be terminated by an additional
    00083    //     '\n', when the string returned in the second step
    00084    //     is of zero length, that is the end of the message.
    00085    //
    00086    //     (If find() does not, it returns MessageBuffer.npos)
    00087    //
    00088    // THROW worm_exception for errors
    00089    //
    00090    void ParseDerivativeData();
    00091
    00092    // ----------------------------------------------------------
    00093    //             for ServerMagnitudeRequest class
    00094    // ----------------------------------------------------------
    00095
    00096    int TestValue;
    00097
    00098 public:
    00099
    00100    // ----------------------------------------------------------
    00101    //             for ServerMagnitudeRequest class
    00102    // ----------------------------------------------------------
    00103
    00104    ServerMagnitudeRequest();
    00105
    00106    void SetTestValue( int p_value );
    00107
    00108    int GetTestValue();
    00109
    00110 };
    00111
    00112 #endif // !defined(MAGNSERVERREQUEST_H)