Hi,

I am trying a Round Trip Engineering cycle by doing the "Reverse
Engineer..." on the attached code as explained in
http://www.rational.com/technotes/rose_html/Rose_html/technote_13346.html

Note: the class Socket created in the model does not show any
inheritance while the code is:
class Socket : public std::iostream { ... }

When I perform the "Generate Code..." it's adding the
GlobalUnicIdentifier nicely (e.g. //##ModelId=3B5E29EC02A7) but also
gets ride of the inheritance I had before:
class Socket { ... }

Any idea what I could have possibly done wrong?
Thanks in advance for you help,
Herve.

--
Herve Blanc
phone: 1 408 586 6437
fax:   1 408 586 4675
mailto:[EMAIL PROTECTED]

Schlumberger Semiconductor Solutions
150 Baytech Drive,
San Jose, CA 95134-2302, USA
http://www.slb.com/


#ifndef _SAPPHIRE_UTIL_SOCKET_HH_
#define _SAPPHIRE_UTIL_SOCKET_HH_

//-----------------------------------------------------------------------------
/*
    Copyright Schlumberger Technologies Corp. unpublished work, created
    2001. This computer program includes Confidential, Proprietary
    Information and is a Trade Secret of Schlumberger Technology Corp. All
    use, disclosure, and/or reproduction is prohibited unless authorized
    in writing. All Rights Reserved.
*/
//-----------------------------------------------------------------------------

#include <iostream>
#include <fstream>
#include "SocketBuffer.hh"

namespace Sapphire
        {
namespace Communications
        {
//! A wrapper around Unix sockets which permits C++ stream operations.

class Socket : public std::iostream
        {
public:
        Socket(const char *hostname, uint16_t port);
        Socket(int fd);
        virtual ~Socket();

        operator int() const;

        bool IsOk() const;

private:
        // Disallow implicitly generated methods.

        Socket(const Socket &); //!< Disallowed, not implemented.
        Socket &operator=(const Socket &);      //!< Disallowed, not implemented.

        //! The file descriptor of the underlying Unix socket.

        int _fd;

        //! This implements our IOStream buffering strategy (line-buffered).

        SocketBuffer buffer;
        };
        }
        }

#endif _SAPPHIRE_UTIL_SOCKET_HH_
#ifndef _SAPPHIRE_UTIL_SOCKETBUFFER_HH_
#define _SAPPHIRE_UTIL_SOCKETBUFFER_HH_

//-----------------------------------------------------------------------------
/*
    Copyright Schlumberger Technologies Corp. unpublished work, created
    2001. This computer program includes Confidential, Proprietary
    Information and is a Trade Secret of Schlumberger Technology Corp. All
    use, disclosure, and/or reproduction is prohibited unless authorized
    in writing. All Rights Reserved.
*/
//-----------------------------------------------------------------------------

#include <strstream>
#include <sys/param.h>

namespace Sapphire
        {
namespace Communications
        {
//! An IOStream buffer which implements a line-buffering strategy.

class SocketBuffer : public std::streambuf
        {
        //! Shortcut for the traits::eof() method.

        typedef std::char_traits<char> traits;

public:
        SocketBuffer();
        virtual ~SocketBuffer();
        void Attach(int fd);

protected:
        // All these are inherited from std::streambuf.

        virtual int overflow(int c = traits::eof());
        virtual long showmanyc();
        virtual int sync();
        virtual int underflow();

private:
        //! The file descriptor of the underlying Unix socket.

        int _fd;

        //! The "get" buffer.
        /*! This buffer stores characters that have been read from the
           socket but have not yet been given back to the stream. */

        char _gbuffer[MAXBSIZE];

        //! The "put" buffer.
        /*! This buffer stores characters that have been passed to
            us, but have not yet been written out to the socket. */

        char _pbuffer[MAXBSIZE];
        };
        }
        }

#endif _SAPPHIRE_UTIL_SOCKETBUFFER_HH_

Reply via email to