Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

property.h

Go to the documentation of this file.
00001 // -*- mode: C++; c-file-style: "stroustrup"; c-basic-offset: 4; indent-tabs-mode: nil; -*-
00002 ////////////////////////////////////////////////////////////////////
00003 //
00004 // Filename : property.h (base)
00005 //
00006 // This file is a part of the UPPAAL toolkit.
00007 // Copyright (c) 1995 - 2003, Uppsala University and Aalborg University.
00008 // All right reserved.
00009 //
00010 // $Id: property.h,v 1.9 2004/08/17 14:55:18 behrmann Exp $
00011 //
00012 /////////////////////////////////////////////////////////////////////
00013 
00014 #ifndef INCLUDE_BASE_PROPERTY_H
00015 #define INCLUDE_BASE_PROPERTY_H
00016 
00017 #include "base/inttypes.h"
00018 
00019 namespace base
00020 {
00021     /** Global property types.
00022      * On a number of components there is
00023      * a setProperty method used to set a particular property. If we take
00024      * pipeline/components.h as an example we may have properties for
00025      * different kinds of buffers, such as, PWList. Implementations are
00026      * scattered in several modules so it is better to centralize all the
00027      * properties in one place.
00028      * Properties are expected to be used with methods
00029      * setProperty(property_t, const void*): for a given property there is
00030      * an expected type of data to read.
00031      */
00032     typedef int const * property_t;
00033 
00034 
00035     /** We choose to let the compiler generate unique IDs for
00036      * the properties. This will also work for imported properties
00037      * from external plugins and it will ensure compatibility between
00038      * properties in different modules. This macro declares a property
00039      * (in a .cpp file). The property name must be declared extern in
00040      * a .h header (property.h in a proper module). For this to work
00041      * the macro MODULE_NAME must be declared locally in the .cpp file.
00042      */
00043 #define DEF_PROPERTY(NAME)                               \
00044 static const char string_##NAME[] = MODULE_NAME":"#NAME; \
00045 base::property_t NAME = (base::property_t) string_##NAME
00046 
00047 
00048     /** This macro is used only for debugging and is used to
00049      * print the internal string used as a unique ID.
00050      */
00051 #define PROPERTY2STRING(NAME) ((const char*)NAME)
00052 
00053 
00054     /* Properties for module "base" */
00055     extern property_t EXACT_RELATION; ///< sets a relation flag, expects bool* 
00056     extern property_t FLAG;           ///< sets a generic flag, expects bool*
00057     extern property_t SIZE;           ///< sets a generic size, expects uint32_t*
00058 }
00059 
00060 #endif // INCLUDE_BASE_PROPERTY_H

Generated on Fri Jun 30 00:02:30 2006 for Module base by  doxygen 1.4.2