Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
d119dfe7
Commit
d119dfe7
authored
16 years ago
by
Mark Olesen
Browse files
Options
Downloads
Plain Diff
Merge commit 'OpenCFD/master' into olesenm
Conflicts: src/OpenFOAM/db/runTimeSelection/runTimeSelectionTables.H
parents
d31ce5b9
1b843a3c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/OpenFOAM/db/runTimeSelection/runTimeSelectionTables.H
+62
-2
62 additions, 2 deletions
src/OpenFOAM/db/runTimeSelection/runTimeSelectionTables.H
with
62 additions
and
2 deletions
src/OpenFOAM/db/runTimeSelection/runTimeSelectionTables.H
+
62
−
2
View file @
d119dfe7
...
...
@@ -28,6 +28,12 @@ Class
Description
Macros to enable the easy declaration of run-time selection tables.
declareRunTimeSelectionTable is used to create a run-time selection table
for a base-class which holds constructor pointers on the table.
declareRunTimeNewSelectionTable is used to create a run-time selection
table for a derived-class which holds "New" pointers on the table.
\*---------------------------------------------------------------------------*/
#include
"token.H"
...
...
@@ -90,6 +96,59 @@ Description
static void destroy##argNames##ConstructorTables()
// external use:
// ~~~~~~~~~~~~~
// declare a run-time selection for derived classes:
#define declareRunTimeNewSelectionTable\
(autoPtr,baseType,argNames,argList,parList) \
\
/* Construct from argList function pointer type */
\
typedef autoPtr<baseType> (*argNames##ConstructorPtr)argList; \
\
/* Construct from argList function table type */
\
typedef HashTable<argNames##ConstructorPtr, word, string::hash> \
argNames##ConstructorTable; \
\
/* Construct from argList function pointer table pointer */
\
static argNames##ConstructorTable* argNames##ConstructorTablePtr_; \
\
/* Class to add constructor from argList to table */
\
template<class baseType##Type> \
class add##argNames##ConstructorToTable \
{ \
public: \
\
static autoPtr<baseType> New##baseType argList \
{ \
return autoPtr<baseType>(baseType##Type::New parList.ptr()); \
} \
\
add##argNames##ConstructorToTable \
( \
const word& lookup = baseType##Type::typeName \
) \
{ \
construct##argNames##ConstructorTables(); \
argNames##ConstructorTablePtr_->insert \
( \
lookup, \
New##baseType \
); \
} \
\
~add##argNames##ConstructorToTable() \
{ \
destroy##argNames##ConstructorTables(); \
} \
}; \
\
/* Table constructor called from the table add function */
\
static void construct##argNames##ConstructorTables(); \
\
/* Table destructor called from the table add function destructor */
\
static void destroy##argNames##ConstructorTables()
// internal use:
// constructor aid
#define defineRunTimeSelectionTableConstructor\
...
...
@@ -151,7 +210,7 @@ Description
// ~~~~~~~~~~~~~
// define run-time selection table
#define defineRunTimeSelectionTable\
(baseType,argNames) \
(baseType,argNames)
\
\
defineRunTimeSelectionTablePtr(baseType,argNames); \
defineRunTimeSelectionTableConstructor(baseType,argNames) \
...
...
@@ -162,7 +221,8 @@ Description
// ~~~~~~~~~~~~~
// define run-time selection table for template classes
// use when baseType doesn't need a template argument (eg, is a typedef)
#define defineTemplateRunTimeSelectionTable(baseType,argNames) \
#define defineTemplateRunTimeSelectionTable\
(baseType,argNames) \
\
template<> \
defineRunTimeSelectionTablePtr(baseType,argNames); \
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment