VuTargetEntity

Superclasses

VuEntity

other subclasses:

VuTargetEntity

Subclasses

 friend class VuServerThread;
public:
  virtual ~VuTargetEntity();

  // virtual function interface
  virtual int SaveSize();
  virtual int Save(VU_BYTE **stream);
  virtual int Save(FILE *file);

  // Special VU type getters
  virtual VU_BOOL IsTarget();   // returns TRUE

  virtual VU_BOOL HasTarget(VU_ID id)=0; // TRUE --> id contains (or is) ent
  virtual VU_BOOL InTarget(VU_ID id)=0;  // TRUE --> ent contained by (or is) id

#ifdef VU_USE_COMMS
  virtual VuTargetEntity *ForwardingTarget(VuMessage *msg = 0);

  int FlushOutboundMessageBuffer();
  int SendMessage(VuMessage *msg);
  int GetMessages();
  int SendQueuedMessage ();

  void SetDirty (void);
  void ClearDirty (void);
  int IsDirty (void);
 
  // normal (best effort) comms handle
  VuCommsConnectStatus GetCommsStatus() { return bestEffortComms_.status_; }
  ComAPIHandle GetCommsHandle() { return bestEffortComms_.handle_; }
  void SetCommsStatus(VuCommsConnectStatus cs) { bestEffortComms_.status_ = cs;}
  void SetCommsHandle(ComAPIHandle ch, int bufSize=0, int packSize=0);

  // reliable comms handle
  VuCommsConnectStatus GetReliableCommsStatus() {return reliableComms_.status_;}
  ComAPIHandle GetReliableCommsHandle() { return reliableComms_.handle_; }
  void SetReliableCommsStatus(VuCommsConnectStatus cs) { reliableComms_.status_ = cs; }
  void SetReliableCommsHandle(ComAPIHandle ch, int bufSize=0, int packSize=0);

  int BytesPending();
  int MaxPacketSize();
  int MaxMessageSize();
  int MaxReliablePacketSize();
  int MaxReliableMessageSize();

protected:
  int Flush(VuCommsContext *ctxt);
  int FlushLow(VuCommsContext *ctxt);
  int SendOutOfBand(VuCommsContext *ctxt, VuMessage *msg);
  int SendNormalPriority(VuCommsContext *ctxt, VuMessage *msg);
  int SendLowPriority(VuCommsContext *ctxt, VuMessage *msg);
#endif

protected:
  VuTargetEntity(int type);
  VuTargetEntity(VU_BYTE **stream);
  VuTargetEntity(FILE *file);

private:
  int LocalSize();                      // returns local bytes written

//data
protected:
#ifdef VU_USE_COMMS
  VuCommsContext bestEffortComms_;
  VuCommsContext reliableComms_;
#endif
  int dirty;