This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088
Dependents: MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more
NyLPC_cPtrTbl.h
00001 /********************************************************************************* 00002 * PROJECT: MiMic 00003 * -------------------------------------------------------------------------------- 00004 * 00005 * This file is part of MiMic 00006 * Copyright (C)2011 Ryo Iizuka 00007 * 00008 * MiMic is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published 00010 * by the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 * 00021 * For further information please contact. 00022 * http://nyatla.jp/ 00023 * <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp> 00024 * 00025 *********************************************************************************/ 00026 #ifndef NYLPC_PTRTABLE_H_ 00027 #define NYLPC_PTRTABLE_H_ 00028 00029 00030 #include "NyLPC_stdlib.h" 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif /* __cplusplus */ 00035 00036 /********************************************************************** 00037 * 00038 * NyLPC_TcPtrTbl 00039 * 00040 **********************************************************************/ 00041 /** 00042 * ポインタを格納するテーブルです。 00043 * 固定長のメモリ領域をポインタテーブルとして管理します。 00044 * 要素はNULLを無効値とします。 00045 */ 00046 typedef struct NyLPC_TcPtrTbl NyLPC_TcPtrTbl_t; 00047 00048 00049 00050 struct NyLPC_TcPtrTbl 00051 { 00052 /** 配列の最大サイズ*/ 00053 NyLPC_TUInt16 size; 00054 /** 配列の現在の長さ*/ 00055 NyLPC_TUInt16 len; 00056 /** 配列*/ 00057 void** buf; 00058 }; 00059 00060 00061 /** 00062 * コンストラクタです。 00063 * メモリを初期化します。 00064 * @param i_buf 00065 * インスタンスを格納するメモリを指定します。バッファサイズは、sizeof(void*)*i_sizeである必要があります。 00066 * @param i_size 00067 * テーブルのサイズを指定します。 00068 */ 00069 void NyLPC_cPtrTbl_initialize(NyLPC_TcPtrTbl_t* i_inst,void** i_buf,NyLPC_TUInt16 i_size); 00070 00071 void* NyLPC_cPtrTbl_get(NyLPC_TcPtrTbl_t* i_inst,NyLPC_TUInt16 i_index); 00072 00073 void NyLPC_cPtrTbl_set(NyLPC_TcPtrTbl_t* i_inst,NyLPC_TUInt16 i_index,void* i_val); 00074 00075 /** 00076 * リストへ要素を追加します。 00077 * @i_val 00078 * NULL以外を指定します。 00079 * @return 00080 * 追加した要素のインデクス番号を返します。 00081 * 失敗した場合、-1を返します。 00082 */ 00083 NyLPC_TInt16 NyLPC_cPtrTbl_add(NyLPC_TcPtrTbl_t* i_inst,void* i_val); 00084 00085 void NyLPC_cPtrTbl_remove(NyLPC_TcPtrTbl_t* i_inst,NyLPC_TUInt16 i_index); 00086 00087 /** 00088 * 現在の長さを返します。 00089 */ 00090 NyLPC_TInt16 NyLPC_cPtrTbl_getLength(NyLPC_TcPtrTbl_t* i_inst); 00091 00092 /** 00093 * 空き領域の有無を返します。 00094 */ 00095 NyLPC_TBool NyLPC_cPtrTbl_hasEmpty(NyLPC_TcPtrTbl_t* i_inst); 00096 00097 /** 00098 * ポインタに一致するインデクスを返します。 00099 */ 00100 NyLPC_TInt16 NyLPC_cPtrTbl_getIndex(NyLPC_TcPtrTbl_t* i_inst,void* i_val); 00101 00102 #ifdef __cplusplus 00103 } 00104 #endif /* __cplusplus */ 00105 00106 #endif /* NYLPC_PTRTABLE_H_ */
Generated on Tue Jul 12 2022 15:46:16 by 1.7.2