Yuki Suga / RTnoV4

Dependencies:   EthernetInterface mbed-rtos

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PortBase.cpp Source File

PortBase.cpp

00001 /*******************************************
00002  * PortBase.h
00003  * @author Yuki Suga
00004  * @copyright Yuki Suga (ysuga.net) Nov, 10th, 2010.
00005  * @license LGPLv3
00006  *****************************************/
00007 #define RTNO_SUBMODULE_DEFINE
00008 
00009 #include <stdlib.h>
00010 #include <string.h>
00011 #include "PortBase.h"
00012 #include "NullBuffer.h"
00013 
00014 PortBase* PortBase_create() {
00015   return (PortBase*)malloc(sizeof(PortBase));
00016 }
00017 
00018 void PortBase_init(PortBase* portBase, const char* name, char typeCode, PortBuffer* dataBuffer)
00019 {
00020   portBase->pName = (char*)malloc(strlen(name)+1);
00021   strcpy(portBase->pName, name);
00022   portBase->typeCode = typeCode;
00023   portBase->pPortBuffer = dataBuffer;
00024 }
00025 
00026 void PortBase_destroy(PortBase* pPortBase)
00027 {
00028   free(pPortBase->pName);
00029   free(pPortBase);
00030 }