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:   EthernetInterface mbed-rtos

Committer:
ysuga
Date:
Thu Aug 29 05:29:55 2013 +0000
Revision:
7:6c7af1d50fb3
Parent:
0:5f7bc45bc2e8
update v5

Who changed what in which revision?

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