COSA
An Object-Oriented Platform for Arduino Programming
Registry.hh File Reference
#include "Cosa/Types.h"
#include "Cosa/EEPROM.hh"
#include "Cosa/IOStream.hh"
Include dependency graph for Registry.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Registry
 
struct  Registry::item_t
 
struct  Registry::item_list_t
 
class  Registry::Iterator
 
class  Registry::Action
 
struct  Registry::action_t
 
struct  Registry::blob_t
 

Macros

#define REGISTRY_BEGIN(var, name)
 
#define REGISTRY_LIST_ITEM(var)   &var.item,
 
#define REGISTRY_BLOB_ITEM(var)   &var ## _blob.item,
 
#define REGISTRY_ACTION_ITEM(var)   &var ## _action.item,
 
#define REGISTRY_END(var)
 
#define REGISTRY_ACTION(var, name)
 
#define REGISTRY_BLOB(var, name, mem, readonly)
 
#define REGISTRY_BLOB_VAR(type, var, name, value, readonly)
 
#define REGISTRY_BLOB_STRUCT(type, var, name, readonly)
 
#define REGISTRY_BLOB_PSTR(var, name, value)
 

Functions

IOStreamoperator<< (IOStream &outs, Registry::item_P item)
 
IOStreamoperator<< (IOStream &outs, Registry::item_list_P list)
 

Detailed Description

Version
1.0

License

Copyright (C) 2013-2015, Mikael Patel

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

This file is part of the Arduino Che Cosa project.

Definition in file Registry.hh.

Macro Definition Documentation

#define REGISTRY_ACTION (   var,
  name 
)
Value:
const char var ## _name[] __PROGMEM = name; \
const Registry::action_t var ## _action __PROGMEM = { \
{ \
(str_P) var ## _name, \
}, \
&var \
};
#define __PROGMEM
Definition: Types.h:183
static const uint8_t READONLY
Definition: Registry.hh:62
Action function.
Definition: Registry.hh:44
const class prog_str * str_P
Definition: Types.h:187
In data memory.
Definition: Registry.hh:54

Support macro to define a registry action in program memory.

Parameters
[in]varregistry action item to create.
[in]namestring of registry item.

Definition at line 443 of file Registry.hh.

#define REGISTRY_ACTION_ITEM (   var)    &var ## _action.item,

Definition at line 420 of file Registry.hh.

#define REGISTRY_BEGIN (   var,
  name 
)
Value:
const char var ## _name[] __PROGMEM = name; \
const Registry::item_P var ## _list[] __PROGMEM = {
#define __PROGMEM
Definition: Types.h:183

Support macro to start the definition of a registery item list in program memory. Used in the form: REGISTRY_BEGIN(var,name) REGISTRY_XXX_ITEM(item-1) ... REGISTRY_XXX_ITEM(item-n) REGISTRY_END(var,n)

Parameters
[in]varregistry item list to create.
[in]namestring for registry item.

Definition at line 408 of file Registry.hh.

#define REGISTRY_BLOB (   var,
  name,
  mem,
  readonly 
)
Value:
const char var ## _blob_name[] __PROGMEM = name; \
const Registry::blob_t var ## _blob __PROGMEM = { \
{ \
(str_P) var ## _blob_name, \
Registry::IN_ ## mem | (readonly << 7) \
}, \
(void*) &var, \
sizeof(var) \
};
General binary object.
Definition: Registry.hh:45
#define __PROGMEM
Definition: Types.h:183
const class prog_str * str_P
Definition: Types.h:187

Support macro to define a registry binary object item in program memory.

Parameters
[in]varregistry blob to create.
[in]namestring of registry item.
[in]memstorage type (SRAM, PROGMEM or EEMEM).
[in]readonlyaccess.

Definition at line 462 of file Registry.hh.

#define REGISTRY_BLOB_ITEM (   var)    &var ## _blob.item,

Definition at line 419 of file Registry.hh.

#define REGISTRY_BLOB_PSTR (   var,
  name,
  value 
)
Value:
static const char var[] __PROGMEM = value; \
REGISTRY_BLOB(var,name,PROGMEM,true)
#define REGISTRY_BLOB(var, name, mem, readonly)
Definition: Registry.hh:462
#define __PROGMEM
Definition: Types.h:183

Support macro to define a registry binary object item in program memory and string variable in program memory as reference. Values is always READONLY.

Parameters
[in]varregistry blob to create.
[in]namestring of registry item.
[in]valuestring for variable.

Definition at line 507 of file Registry.hh.

#define REGISTRY_BLOB_STRUCT (   type,
  var,
  name,
  readonly 
)
Value:
static type var; \
REGISTRY_BLOB(var,name,SRAM,readonly)
#define REGISTRY_BLOB(var, name, mem, readonly)
Definition: Registry.hh:462

Support macro to define a registry binary object item in program memory and struct variable in SRAM as reference.

Parameters
[in]typevariable data type.
[in]varregistry blob to create.
[in]namestring of registry item.
[in]readonlyaccess.

Definition at line 495 of file Registry.hh.

#define REGISTRY_BLOB_VAR (   type,
  var,
  name,
  value,
  readonly 
)
Value:
static type var = value; \
REGISTRY_BLOB(var,name,SRAM,readonly)
#define REGISTRY_BLOB(var, name, mem, readonly)
Definition: Registry.hh:462

Support macro to define a registry binary object item in program memory and variable in SRAM as reference.

Parameters
[in]typevariable data type.
[in]varregistry blob to create.
[in]namestring of registry item.
[in]valueof variable (initial).
[in]readonlyaccess.

Definition at line 483 of file Registry.hh.

#define REGISTRY_END (   var)
Value:
}; \
{ \
(str_P) var ## _name, \
}, \
membersof(var ## _list), \
var ## _list \
};
#define __PROGMEM
Definition: Types.h:183
static const uint8_t READONLY
Definition: Registry.hh:62
#define membersof(x)
Definition: Types.h:165
In program memory.
Definition: Registry.hh:53
List of items.
Definition: Registry.hh:43
const class prog_str * str_P
Definition: Types.h:187

Support macro to complete a registry in program memory.

Parameters
[in]varregistry to create.

Definition at line 426 of file Registry.hh.

#define REGISTRY_LIST_ITEM (   var)    &var.item,

Support macro to add a registry item to an item list in program memory. The item can be any of the registry item types; ITEM, ITEM_LIST, ACTION and BLOB.

Parameters
[in]varitem reference to add.

Definition at line 418 of file Registry.hh.

Function Documentation

IOStream& operator<< ( IOStream outs,
Registry::item_P  item 
)

Print item to given output stream.

Parameters
[in]outsoutput stream.
[in]itemregistry item.
Returns
output stream.

Definition at line 149 of file Registry.cpp.

IOStream& operator<< ( IOStream outs,
Registry::item_list_P  list 
)

Print item list to given output stream.

Parameters
[in]outsoutput stream.
[in]listregistry item list.
Returns
output stream.

Definition at line 194 of file Registry.cpp.