![](/media/cache/profiles/94aef38441efa3380a3bed3faf1f9d5d.50x50_q85.jpg)
RTno/SequenceDataType.cpp@0:3c49891bc39d, 2011-07-29 (annotated)
- Committer:
- nucho
- Date:
- Fri Jul 29 11:23:44 2011 +0000
- Revision:
- 0:3c49891bc39d
- Child:
- 1:7f0fc0d1f777
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nucho | 0:3c49891bc39d | 1 | /******************************************* |
nucho | 0:3c49891bc39d | 2 | * SequenceDataType.h |
nucho | 0:3c49891bc39d | 3 | * @author Yuki Suga |
nucho | 0:3c49891bc39d | 4 | * @copyright Yuki Suga (ysuga.net) Nov, 10th, 2010. |
nucho | 0:3c49891bc39d | 5 | * @license LGPLv3 |
nucho | 0:3c49891bc39d | 6 | *****************************************/ |
nucho | 0:3c49891bc39d | 7 | |
nucho | 0:3c49891bc39d | 8 | #include <stdlib.h> |
nucho | 0:3c49891bc39d | 9 | #include "SequenceDataType.h" |
nucho | 0:3c49891bc39d | 10 | #include "mbed.h" |
nucho | 0:3c49891bc39d | 11 | |
nucho | 0:3c49891bc39d | 12 | Serial pc3(p9,p10); |
nucho | 0:3c49891bc39d | 13 | |
nucho | 0:3c49891bc39d | 14 | SequenceDataType::SequenceDataType(void** ptrptr) |
nucho | 0:3c49891bc39d | 15 | { |
nucho | 0:3c49891bc39d | 16 | m_ptrptr = ptrptr;*m_ptrptr = 0;len = 0; |
nucho | 0:3c49891bc39d | 17 | } |
nucho | 0:3c49891bc39d | 18 | |
nucho | 0:3c49891bc39d | 19 | SequenceDataType::~SequenceDataType() |
nucho | 0:3c49891bc39d | 20 | { |
nucho | 0:3c49891bc39d | 21 | free(*m_ptrptr); |
nucho | 0:3c49891bc39d | 22 | } |
nucho | 0:3c49891bc39d | 23 | |
nucho | 0:3c49891bc39d | 24 | |
nucho | 0:3c49891bc39d | 25 | void SequenceDataType::length(int size) |
nucho | 0:3c49891bc39d | 26 | { |
nucho | 0:3c49891bc39d | 27 | len = size; |
nucho | 0:3c49891bc39d | 28 | pc3.printf("len222\n\r"); |
nucho | 0:3c49891bc39d | 29 | free(*m_ptrptr); |
nucho | 0:3c49891bc39d | 30 | pc3.printf("len333\n\r"); |
nucho | 0:3c49891bc39d | 31 | *m_ptrptr = (void*)malloc(size * SizeofData()); |
nucho | 0:3c49891bc39d | 32 | //*m_ptrptr = (void*)malloc(size * 4); |
nucho | 0:3c49891bc39d | 33 | } |
nucho | 0:3c49891bc39d | 34 | |
nucho | 0:3c49891bc39d | 35 | #if 0 |
nucho | 0:3c49891bc39d | 36 | int SequenceDataType::SizeofData() { |
nucho | 0:3c49891bc39d | 37 | switch(m_TypeCode) { |
nucho | 0:3c49891bc39d | 38 | case 'b': |
nucho | 0:3c49891bc39d | 39 | case 'B': |
nucho | 0:3c49891bc39d | 40 | case 'o': |
nucho | 0:3c49891bc39d | 41 | case 'O': |
nucho | 0:3c49891bc39d | 42 | case 'c': |
nucho | 0:3c49891bc39d | 43 | case 'C': |
nucho | 0:3c49891bc39d | 44 | return 1; |
nucho | 0:3c49891bc39d | 45 | default: |
nucho | 0:3c49891bc39d | 46 | return 4; |
nucho | 0:3c49891bc39d | 47 | } |
nucho | 0:3c49891bc39d | 48 | } |
nucho | 0:3c49891bc39d | 49 | #endif |