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

Committer:
ysuga
Date:
Thu Feb 09 02:33:10 2012 +0000
Revision:
0:9fac71a0bff3
RTno Version 3: RTno is a software library and tool to connect embedded devices like arduino and mbed to RT-middleware world.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ysuga 0:9fac71a0bff3 1 #ifndef SEQUENCE_HEADER_INCLUDED
ysuga 0:9fac71a0bff3 2 #define SEQUENCE_HEADER_INCLUDED
ysuga 0:9fac71a0bff3 3
ysuga 0:9fac71a0bff3 4 #include <stdint.h>
ysuga 0:9fac71a0bff3 5 #include <stdlib.h>
ysuga 0:9fac71a0bff3 6
ysuga 0:9fac71a0bff3 7 class SequenceBase {
ysuga 0:9fac71a0bff3 8 protected:
ysuga 0:9fac71a0bff3 9 uint8_t m_length;
ysuga 0:9fac71a0bff3 10
ysuga 0:9fac71a0bff3 11 public:
ysuga 0:9fac71a0bff3 12 virtual uint8_t length() {
ysuga 0:9fac71a0bff3 13 return m_length;
ysuga 0:9fac71a0bff3 14 }
ysuga 0:9fac71a0bff3 15
ysuga 0:9fac71a0bff3 16 virtual void length(uint8_t len) {};
ysuga 0:9fac71a0bff3 17
ysuga 0:9fac71a0bff3 18 virtual void* getData() = 0;
ysuga 0:9fac71a0bff3 19 };
ysuga 0:9fac71a0bff3 20
ysuga 0:9fac71a0bff3 21
ysuga 0:9fac71a0bff3 22 template<typename T>
ysuga 0:9fac71a0bff3 23 class Sequence : public SequenceBase {
ysuga 0:9fac71a0bff3 24 T *m_ptr;
ysuga 0:9fac71a0bff3 25
ysuga 0:9fac71a0bff3 26 public:
ysuga 0:9fac71a0bff3 27 Sequence() {m_ptr = 0;}
ysuga 0:9fac71a0bff3 28 virtual void length(uint8_t len) {
ysuga 0:9fac71a0bff3 29 m_length = len;
ysuga 0:9fac71a0bff3 30 free((void*)m_ptr);
ysuga 0:9fac71a0bff3 31 m_ptr = (T*)malloc(len * sizeof(T));
ysuga 0:9fac71a0bff3 32 }
ysuga 0:9fac71a0bff3 33
ysuga 0:9fac71a0bff3 34 virtual uint8_t length() {
ysuga 0:9fac71a0bff3 35 return SequenceBase::length();
ysuga 0:9fac71a0bff3 36 }
ysuga 0:9fac71a0bff3 37 T& operator[](uint8_t index) {
ysuga 0:9fac71a0bff3 38 return m_ptr[index];
ysuga 0:9fac71a0bff3 39 }
ysuga 0:9fac71a0bff3 40
ysuga 0:9fac71a0bff3 41 virtual void* getData() { return m_ptr; }
ysuga 0:9fac71a0bff3 42 };
ysuga 0:9fac71a0bff3 43
ysuga 0:9fac71a0bff3 44
ysuga 0:9fac71a0bff3 45 #endif //#ifndef SEQUENCE_HEADER_INCLUDED