RTno is communicating library and framework which allows you to make your embedded device capable of communicating with RT-middleware world. RT-middleware is a platform software to realize Robotic system. In RTM, robots are developed by constructing robotics technologies\' elements (components) named RT-component. Therefore, the RTno helps you to create your own RT-component with your mbed and arduino. To know how to use your RTno device, visit here: http://ysuga.net/robot_e/rtm_e/rtc_e/1065?lang=en To know about RT-middleware and RT-component, visit http://www.openrtm.org

Dependencies:   EthernetNetIf

Dependents:   RTnoV3_LED RTnoV3_Template RTnoV3_ADC RTnoV3_Timer ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Sequence.h Source File

Sequence.h

00001 #ifndef SEQUENCE_HEADER_INCLUDED
00002 #define SEQUENCE_HEADER_INCLUDED
00003 
00004 #include <stdint.h>
00005 #include <stdlib.h>
00006 
00007 class SequenceBase {
00008  protected:
00009     uint8_t m_length;
00010 
00011  public:
00012   virtual uint8_t length() {
00013     return m_length;
00014   }
00015   
00016   virtual void length(uint8_t len) {};
00017 
00018   virtual void* getData() = 0;
00019 };
00020 
00021 
00022 template<typename T>
00023 class Sequence : public SequenceBase {
00024   T *m_ptr;
00025 
00026  public:
00027   Sequence() {m_ptr = 0;}
00028   virtual void length(uint8_t len) {
00029     m_length = len;
00030     free((void*)m_ptr);
00031     m_ptr = (T*)malloc(len * sizeof(T));
00032   }
00033 
00034   virtual uint8_t length() {
00035     return SequenceBase::length();
00036   }
00037   T& operator[](uint8_t index) {
00038     return m_ptr[index];
00039   }
00040 
00041   virtual void* getData() { return m_ptr; }
00042 };
00043 
00044 
00045 #endif //#ifndef SEQUENCE_HEADER_INCLUDED