00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00037 #ifndef CHANNELMAPPING_H
00038 #define CHANNELMAPPING_H
00039 
00040 #include <BasicUtils/BasicSmartPointer.h>
00041 
00042 #include "mappingobj.h"
00043 #include "tracechannel.h"
00044 #include "instructioncontext.h"
00045 
00046 #include <map>
00047 #include <string>
00048 
00049 class ChannelMapping: public MappingObj, public TraceChannel {
00050   
00051  private:
00053   int id;
00054 
00055   typedef std::map<std::string, int> ports_t;
00057   ports_t ports;
00058 
00060   int nextPortId;
00061 
00063   BasicSmartPointer<InstructionContext> instrContext;
00064 
00065   
00066  public:
00067   ChannelMapping(const char *name,
00068                  BasicSmartPointer<InstructionContext> instrContext, int id);
00069   virtual ~ChannelMapping() {}
00070 
00071   
00072   int getId() {return id;}
00073   int getPortId(const char *name);
00074   int getInstructionId(const char *name);
00075   
00076 
00082   mapping_obj_t getType() {return CHANNEL_MAPPING;}
00083 
00084  protected:
00085   int addPort(const char *name);
00086 
00092   int getNextPortId() {nextPortId++; return nextPortId - 1;}
00093 
00094   friend class MappingSAXHandler;
00095 };
00096 #endif