00001 // This is gel/vsrl/vsrl_token.h 00002 #ifndef vsrl_token_h 00003 #define vsrl_token_h 00004 //: 00005 // \file 00006 // In a dynamic programming problem we are given the task of 00007 // assigning one set of tokens to another set of tokens. 00008 // This class represents the abstract token. 00009 // 00010 // \verbatim 00011 // Modifications 00012 // 10 Sep. 2004 Peter Vanroose Inlined all 1-line methods in class decl 00013 // \endverbatim 00014 00015 class vsrl_token 00016 { 00017 int index_; 00018 vsrl_token* assigned_token_; 00019 00020 double x_; //!< the x position 00021 double y_; //!< the y position 00022 00023 public: 00024 00025 // constructor 00026 vsrl_token() : index_(-1), assigned_token_(0), x_(0), y_(0) {} 00027 00028 // destructor 00029 virtual ~vsrl_token() {} 00030 00031 //: does this token represent a null assignment? 00032 virtual bool null_token() {return false;} 00033 00034 //: is this token an intensity token ? 00035 virtual bool intensity_token() {return false;} 00036 00037 //: what is the direct cost of assigning this token to tok 00038 virtual double cost(vsrl_token * /*tok*/) { return 0; } 00039 00040 //: what is the incremental cost of going from from this to tok2 given the assignment going from tok_p to tok_2p 00041 virtual double incremental_cost(vsrl_token * /*tok2*/, vsrl_token * /*tok_p*/, vsrl_token * /*tok_2p*/) { return 0; } 00042 00043 //: get the index of this token 00044 int get_index() const { return index_; } 00045 00046 //: set the index of this token 00047 void set_index(int index) { index_ = index; } 00048 00049 //: get the assigned token 00050 vsrl_token* get_assigned_token() { return assigned_token_; } 00051 00052 //: set the assigned token 00053 void set_assigned_token(vsrl_token *tok) { assigned_token_ = tok; } 00054 00055 //: set the x and y position 00056 void set_position(double x, double y) { x_=x; y_=y; } 00057 00058 //: get the x and y position 00059 void get_position(double &x, double &y) { x= x_; y= y_; } 00060 00061 double get_x() const { return x_; } 00062 double get_y() const { return y_; } 00063 }; 00064 00065 #endif // vsrl_token_h
1.5.1