Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

Cloneable Class Reference

#include <Cloneable.h>

Inheritance diagram for Cloneable:

List of all members.


Detailed Description

An interface for cloning objects -- needed for making copies with polymorphism (operator= doesn't work as virtual).

Definition at line 6 of file Cloneable.h.


Public Member Functions

virtual ~Cloneable ()
 destructor
virtual Cloneableclone () const =0
 returns a copy of this

Constructor & Destructor Documentation

virtual Cloneable::~Cloneable (  )  [inline, virtual]

destructor

Definition at line 9 of file Cloneable.h.


Member Function Documentation

virtual Cloneable* Cloneable::clone (  )  const [pure virtual]

returns a copy of this

When implementing, your class should use its own type as the return type, e.g.:

  class Foo : public Cloneable {
  public:
    //note: return Foo* instead of Cloneable* !
    //Allows users to avoid needing to cast the results
    virtual Foo* clone() { return new Foo(*this); }
  };

HOWEVER, this is currently unsupported in gcc 3.3, which the latest version for which Sony has supplied the patches to work on the Aibo.

So instead, you must currently provide the interface exactly as shown, and then the caller will probably need to cast the result to the known type. Hopefully Sony will eventually update the gcc version to at least 3.4 and we can switch over to use the "covariant return type".

Implemented in plist::ObjectBase, plist::DictionaryOf< PO, Alloc >, plist::ArrayOf< PO, Alloc >, plist::Primitive< T >, plist::Primitive< char >, plist::Primitive< unsigned char >, plist::Primitive< std::string >, plist::NamedEnumeration< T >, plist::DictionaryOf< ObjectBase >, plist::ArrayOf< plist::Primitive< std::string > >, plist::Primitive< float >, plist::Primitive< int >, plist::Primitive< unsigned int >, plist::Primitive< bool >, plist::NamedEnumeration< J_DCT_METHOD >, plist::NamedEnumeration< Config::vision_config::shutter_speeds >, plist::NamedEnumeration< Config::main_config::consoleMode_t >, plist::NamedEnumeration< Config::sound_config::volume_levels >, plist::NamedEnumeration< Config::vision_config::white_balance_levels >, plist::NamedEnumeration< Config::transports >, plist::NamedEnumeration< Config::vision_config::RawCamConfig::encoding_t >, plist::NamedEnumeration< Config::vision_config::RawCamConfig::compression_t >, plist::NamedEnumeration< Config::vision_config::SegCamConfig::compression_t >, and plist::NamedEnumeration< Config::vision_config::gain_levels >.


The documentation for this class was generated from the following file:

Tekkotsu v4.0
Generated Thu Nov 22 00:58:12 2007 by Doxygen 1.5.4