c++ linktypes

Georg Seidel <[email protected]>
Newsgroups gmane.comp.video.gephex.devel
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

what I would like to add/change:

~   * functions for binary serialization which must be implemented
~     (with them the core can save the state of the graph)

~   * maybe make the ascii serialisation optional by moving them
~     into an "AsciiSerializableLink" subclass (images and audio
~     data maybe wont allow serialization to ascii)

Georg

P.S. did not try to compile the files...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBokiA/rP0cdKF/ToRAjO4AKDZVmneQFJWOjfFG+xvpa/tjHMZ5QCgoLfx
JyN9ix2AHS2pNhdyaVCkId8=
=oUTn
-----END PGP SIGNATURE-----

_______________________________________________
gephex-devel mailing list
[email protected]
http://lists.gephex.org/mailman/listinfo/gephex-devel
link.cpp (text/x-c++src, 415 B)
#include "link.h"

namespace gphx
{
  LinkFactory::LinkFactory(const char* name, Logger* l)
    : m_name(name), m_log(l) {}

  LinkFactory::~LinkFactory()
  {
    delete m_log;
  }

  void Link::set_timestamp(double start, double end)
  {
    m_time_start = start;
    m_time_end   = end;
  }

  void Link::get_timestamp(double& start, double& end) const
  {
    start = m_time_start;
    end   = m_time_end;
  }
}
link.h (text/x-chdr, 735 B)
#include "logger.h"

namespace gphx
{

  class Link;

  class LinkFactory
  {
  public:
    LinkFactory(const char* name, Logger* l);

    virtual ~LinkFactory();

    virtual Link* create(alloc_fun_t gphx_alloc, free_fun_t gphx_free) = 0;

    const char* get_spec() const;

  protected:
    const char* m_name;
    Logger* m_log;
  };

  class Link
  {
  public:
    virtual ~Link() = 0;
    
    virtual const Link& operator=(const Link&) = 0;
    
    virtual const char* serialize_ascii() const = 0;
    virtual bool deserialize_ascii(const char*) = 0;

    void set_timestamp(double start, double end);
    void get_timestamp(double& start, double& end) const;

  private:
    double m_time_start;
    double m_time_end;
  };

}
linkfactory.h (text/x-chdr, 0 B)

    
logger.h (text/x-chdr, 226 B)
namespace gphx
{
  class Logger
  {
  public:
    typedef enum { LOG = 0, WARNING = 1, ERROR = 2 } log_level_t;
    
    virtual ~Logger() = 0;
    
    virtual void operator()(log_level_t level, const char* msg) = 0;
  };
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.