Advertisement
Guest User

Untitled

a guest
Apr 28th, 2012
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.23 KB | None | 0 0
  1. #include "node.h"
  2. #include "combinedfragment.h"
  3. class CombinedFragment;
  4. Node::Node()
  5. {
  6.     this->cfrag = NULL;
  7. }
  8.  
  9.  
  10. Node::~Node()
  11. {
  12.    delete (this->cfrag) ;
  13.    this->cfrag = NULL;
  14. }
  15.  
  16. Node& Node:: operator =(const Node& another)
  17. {
  18.     this->type = another.getType();
  19.     this->mfrag = another.getmFrag();
  20.     this->cfrag = another.getcFragP();
  21.     return *this;
  22. }
  23.  
  24. Node::Node(int type,Message frag)
  25. {
  26.         this->type = type;
  27.         this->mfrag = frag;
  28.         this->cfrag = NULL;
  29. }
  30.  
  31.  
  32. Node::Node(int type,CombinedFragment* frag)
  33. {
  34.         this->type = type;
  35.         this->cfrag = frag;
  36. }
  37.  
  38.  
  39. int Node::getType() const
  40. {
  41.     return this->type;
  42. }
  43.  
  44. void Node::setType(int type)
  45. {
  46.     this->type = type;
  47. }
  48.  
  49. Message Node::getmFrag() const
  50. {
  51.     return this->mfrag;
  52. }
  53.  
  54. void Node::setmFrag(Message frag)
  55. {
  56.     this->mfrag = frag;
  57.     this->cfrag = NULL;
  58. }
  59.  
  60.  
  61. CombinedFragment Node::getcFrag()
  62. {
  63.     if(this->cfrag!=NULL)
  64.         return *(this->cfrag);
  65.     else
  66.     {
  67.      CombinedFragment cf_null(string(""),-1);
  68.      return cf_null;
  69.     }
  70. }
  71.  
  72. void Node::setcFrag(CombinedFragment* frag)
  73. {
  74.     this->cfrag = frag;
  75. }
  76.  
  77. CombinedFragment* Node::getcFragP() const
  78. {
  79.     return this->cfrag;
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement