added max-age and content-format

Fork of mbedConnectorInterface by Doug Anson

Committer:
michaeljkoster
Date:
Tue Apr 14 04:00:01 2015 +0000
Revision:
52:822611156e35
Parent:
2:853f9ecc12df
added interfaces for max-age and content-format

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 0:b438482ebbfc 1 /**
ansond 0:b438482ebbfc 2 * @file InstancePointerTable.h
ansond 0:b438482ebbfc 3 * @brief instance pointer table header
ansond 0:b438482ebbfc 4 * @author Doug Anson/Chris Paola
ansond 0:b438482ebbfc 5 * @version 1.0
sam_grove 2:853f9ecc12df 6 * @see
ansond 0:b438482ebbfc 7 *
ansond 0:b438482ebbfc 8 * Copyright (c) 2014
ansond 0:b438482ebbfc 9 *
ansond 0:b438482ebbfc 10 * Licensed under the Apache License, Version 2.0 (the "License");
ansond 0:b438482ebbfc 11 * you may not use this file except in compliance with the License.
ansond 0:b438482ebbfc 12 * You may obtain a copy of the License at
ansond 0:b438482ebbfc 13 *
ansond 0:b438482ebbfc 14 * http://www.apache.org/licenses/LICENSE-2.0
ansond 0:b438482ebbfc 15 *
ansond 0:b438482ebbfc 16 * Unless required by applicable law or agreed to in writing, software
ansond 0:b438482ebbfc 17 * distributed under the License is distributed on an "AS IS" BASIS,
ansond 0:b438482ebbfc 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ansond 0:b438482ebbfc 19 * See the License for the specific language governing permissions and
ansond 0:b438482ebbfc 20 * limitations under the License.
ansond 0:b438482ebbfc 21 */
sam_grove 2:853f9ecc12df 22
sam_grove 2:853f9ecc12df 23 #ifndef __INSTANCE_POINTER_TABLE_H__
sam_grove 2:853f9ecc12df 24 #define __INSTANCE_POINTER_TABLE_H__
sam_grove 2:853f9ecc12df 25
sam_grove 2:853f9ecc12df 26 // Logger support
sam_grove 2:853f9ecc12df 27 #include "Logger.h"
sam_grove 2:853f9ecc12df 28
sam_grove 2:853f9ecc12df 29 // string support
sam_grove 2:853f9ecc12df 30 #include <string>
sam_grove 2:853f9ecc12df 31
sam_grove 2:853f9ecc12df 32 // Configuration
sam_grove 2:853f9ecc12df 33 #include "mbedConnectorInterface.h"
sam_grove 2:853f9ecc12df 34
sam_grove 2:853f9ecc12df 35 // our table row structure
sam_grove 2:853f9ecc12df 36 typedef struct {
sam_grove 2:853f9ecc12df 37 string key;
sam_grove 2:853f9ecc12df 38 void *instance;
sam_grove 2:853f9ecc12df 39 } InstancePointerTableRow;
sam_grove 2:853f9ecc12df 40
sam_grove 2:853f9ecc12df 41 /** InstancePointerTable class
sam_grove 2:853f9ecc12df 42 */
sam_grove 2:853f9ecc12df 43 class InstancePointerTable
sam_grove 2:853f9ecc12df 44 {
sam_grove 2:853f9ecc12df 45 public:
sam_grove 2:853f9ecc12df 46 /**
sam_grove 2:853f9ecc12df 47 Default constructor
sam_grove 2:853f9ecc12df 48 @param logger input the logger instance
sam_grove 2:853f9ecc12df 49 */
sam_grove 2:853f9ecc12df 50 InstancePointerTable(const Logger *logger = NULL);
sam_grove 2:853f9ecc12df 51
sam_grove 2:853f9ecc12df 52 /**
sam_grove 2:853f9ecc12df 53 Destructor
sam_grove 2:853f9ecc12df 54 */
sam_grove 2:853f9ecc12df 55 virtual ~InstancePointerTable();
sam_grove 2:853f9ecc12df 56
sam_grove 2:853f9ecc12df 57 /**
sam_grove 2:853f9ecc12df 58 Add pointer to the instance table
sam_grove 2:853f9ecc12df 59 @param key input the key for the new pointer
sam_grove 2:853f9ecc12df 60 @param instance input the instance pointer to save
sam_grove 2:853f9ecc12df 61 */
sam_grove 2:853f9ecc12df 62 void add(string key,void *instance);
sam_grove 2:853f9ecc12df 63
sam_grove 2:853f9ecc12df 64 /**
sam_grove 2:853f9ecc12df 65 Get a instance pointer index by the name of the key
sam_grove 2:853f9ecc12df 66 @param key input the key to use for the lookup
sam_grove 2:853f9ecc12df 67 @returns the instance pointer if found or NULL if not found
sam_grove 2:853f9ecc12df 68 */
sam_grove 2:853f9ecc12df 69 void *get(string key);
sam_grove 2:853f9ecc12df 70
sam_grove 2:853f9ecc12df 71 /**
sam_grove 2:853f9ecc12df 72 Set the Logger instance
sam_grove 2:853f9ecc12df 73 @param logger input the logger instance
sam_grove 2:853f9ecc12df 74 */
sam_grove 2:853f9ecc12df 75 void setLogger(const Logger *logger);
sam_grove 2:853f9ecc12df 76
sam_grove 2:853f9ecc12df 77 private:
sam_grove 2:853f9ecc12df 78 Logger *m_logger;
sam_grove 2:853f9ecc12df 79 InstancePointerTableRow m_instance_pointer_table[IPT_MAX_ENTRIES];
sam_grove 2:853f9ecc12df 80
sam_grove 2:853f9ecc12df 81 // initialize our table
sam_grove 2:853f9ecc12df 82 void init();
sam_grove 2:853f9ecc12df 83
sam_grove 2:853f9ecc12df 84 // get the next empty slot
sam_grove 2:853f9ecc12df 85 int nextEmptySlot();
sam_grove 2:853f9ecc12df 86
sam_grove 2:853f9ecc12df 87 // index from key
sam_grove 2:853f9ecc12df 88 int indexFromKey(string key);
sam_grove 2:853f9ecc12df 89
sam_grove 2:853f9ecc12df 90 // get our logger
sam_grove 2:853f9ecc12df 91 Logger *logger();
sam_grove 2:853f9ecc12df 92 };
sam_grove 2:853f9ecc12df 93
sam_grove 2:853f9ecc12df 94 #endif // __INSTANCE_POINTER_TABLE_H__