diff --git a/include/trick/compat/sim_services/DataTypes/include/AllocInfo.hh b/include/trick/compat/sim_services/DataTypes/include/AllocInfo.hh deleted file mode 100644 index 36d810fcf..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/AllocInfo.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/AllocInfo.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/ArrayDataType.hh b/include/trick/compat/sim_services/DataTypes/include/ArrayDataType.hh deleted file mode 100644 index dd3b7a3e5..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/ArrayDataType.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/ArrayDataType.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/BitfieldStructMember.hh b/include/trick/compat/sim_services/DataTypes/include/BitfieldStructMember.hh deleted file mode 100644 index 8e137cd5f..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/BitfieldStructMember.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/BitfieldStructMember.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/ChkPtAgent.hh b/include/trick/compat/sim_services/DataTypes/include/ChkPtAgent.hh deleted file mode 100644 index bfe2f04e7..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/ChkPtAgent.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/ChkPtAgent.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/ClassicChkPtAgent.hh b/include/trick/compat/sim_services/DataTypes/include/ClassicChkPtAgent.hh deleted file mode 100644 index 9f45b1765..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/ClassicChkPtAgent.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/ClassicChkPtAgent.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/CompositeDataType.hh b/include/trick/compat/sim_services/DataTypes/include/CompositeDataType.hh deleted file mode 100644 index faa6eb63e..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/CompositeDataType.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/CompositeDataType.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/CompositeValue.hh b/include/trick/compat/sim_services/DataTypes/include/CompositeValue.hh deleted file mode 100644 index d34d3928d..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/CompositeValue.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/CompositeValue.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/DataType.hh b/include/trick/compat/sim_services/DataTypes/include/DataType.hh deleted file mode 100644 index d7e8905ef..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/DataType.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/DataType.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/EnumDataType.hh b/include/trick/compat/sim_services/DataTypes/include/EnumDataType.hh deleted file mode 100644 index fce828465..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/EnumDataType.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/EnumDataType.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/EnumDictionary.hh b/include/trick/compat/sim_services/DataTypes/include/EnumDictionary.hh deleted file mode 100644 index 65d4dd8fe..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/EnumDictionary.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/EnumDictionary.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/Enumerator.hh b/include/trick/compat/sim_services/DataTypes/include/Enumerator.hh deleted file mode 100644 index 80b79e73a..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/Enumerator.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/Enumerator.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/FloatingPointValue.hh b/include/trick/compat/sim_services/DataTypes/include/FloatingPointValue.hh deleted file mode 100644 index 89178ccba..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/FloatingPointValue.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/FloatingPointValue.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/IntegerValue.hh b/include/trick/compat/sim_services/DataTypes/include/IntegerValue.hh deleted file mode 100644 index 44262620e..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/IntegerValue.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/IntegerValue.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/LexicalAnalyzer.hh b/include/trick/compat/sim_services/DataTypes/include/LexicalAnalyzer.hh deleted file mode 100644 index 6c252eda1..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/LexicalAnalyzer.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/LexicalAnalyzer.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/MemMgr.hh b/include/trick/compat/sim_services/DataTypes/include/MemMgr.hh deleted file mode 100644 index 6e09ed329..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/MemMgr.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/MemMgr.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/NormalStructMember.hh b/include/trick/compat/sim_services/DataTypes/include/NormalStructMember.hh deleted file mode 100644 index ea675e83a..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/NormalStructMember.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/NormalStructMember.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/NumericValue.hh b/include/trick/compat/sim_services/DataTypes/include/NumericValue.hh deleted file mode 100644 index 83ef98083..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/NumericValue.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/NumericValue.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/ParsedDeclaration.hh b/include/trick/compat/sim_services/DataTypes/include/ParsedDeclaration.hh deleted file mode 100644 index 2371c1452..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/ParsedDeclaration.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/ParsedDeclaration.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/PointerDataType.hh b/include/trick/compat/sim_services/DataTypes/include/PointerDataType.hh deleted file mode 100644 index 2012f9e6d..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/PointerDataType.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/PointerDataType.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/PointerValue.hh b/include/trick/compat/sim_services/DataTypes/include/PointerValue.hh deleted file mode 100644 index 38cea815f..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/PointerValue.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/PointerValue.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/PrimitiveDataType.hh b/include/trick/compat/sim_services/DataTypes/include/PrimitiveDataType.hh deleted file mode 100644 index 80d84e0f2..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/PrimitiveDataType.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/PrimitiveDataType.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/StaticStructMember.hh b/include/trick/compat/sim_services/DataTypes/include/StaticStructMember.hh deleted file mode 100644 index dd32f9603..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/StaticStructMember.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/StaticStructMember.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/StringValue.hh b/include/trick/compat/sim_services/DataTypes/include/StringValue.hh deleted file mode 100644 index 9760a4cb7..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/StringValue.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/StringValue.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/StructMember.hh b/include/trick/compat/sim_services/DataTypes/include/StructMember.hh deleted file mode 100644 index 69ca8e9e6..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/StructMember.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/StructMember.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/TypeDictionary.hh b/include/trick/compat/sim_services/DataTypes/include/TypeDictionary.hh deleted file mode 100644 index 4e5a1efa8..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/TypeDictionary.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/TypeDictionary.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/Value.hh b/include/trick/compat/sim_services/DataTypes/include/Value.hh deleted file mode 100644 index 72d1f5990..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/Value.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/Value.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/VarAccessInfo.hh b/include/trick/compat/sim_services/DataTypes/include/VarAccessInfo.hh deleted file mode 100644 index c7edacfe1..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/VarAccessInfo.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/VarAccessInfo.hh" diff --git a/include/trick/compat/sim_services/DataTypes/include/Variable.hh b/include/trick/compat/sim_services/DataTypes/include/Variable.hh deleted file mode 100644 index f7aba4d3f..000000000 --- a/include/trick/compat/sim_services/DataTypes/include/Variable.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/Variable.hh" diff --git a/include/trick/compat/sim_services/DataTypes/testing/DataTypeTestSupport.hh b/include/trick/compat/sim_services/DataTypes/testing/DataTypeTestSupport.hh deleted file mode 100644 index 4941bec35..000000000 --- a/include/trick/compat/sim_services/DataTypes/testing/DataTypeTestSupport.hh +++ /dev/null @@ -1 +0,0 @@ -#include "trick/DataTypeTestSupport.hh" diff --git a/trick_source/sim_services/DataTypes/Doxyfile b/trick_source/sim_services/DataTypes/Doxyfile deleted file mode 100644 index 51302a542..000000000 --- a/trick_source/sim_services/DataTypes/Doxyfile +++ /dev/null @@ -1,1716 +0,0 @@ -# Doxyfile 1.7.4 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" "). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = Declarations - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer -# a quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = - -# With the PROJECT_LOGO tag one can specify an logo or icon that is -# included in the documentation. The maximum height of the logo should not -# exceed 55 pixels and the maximum width should not exceed 200 pixels. -# Doxygen will copy the logo to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = ./docs - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful if your file system -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this -# tag. The format is ext=language, where ext is a file extension, and language -# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, -# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make -# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C -# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions -# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also makes the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and -# unions are shown inside the group in which they are included (e.g. using -# @ingroup) instead of on a separate page (for HTML and Man pages) or -# section (for LaTeX and RTF). - -INLINE_GROUPED_CLASSES = NO - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = NO - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penalty. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will roughly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols - -SYMBOL_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespaces are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen -# will list include files with double quotes in the documentation -# rather than with sharp brackets. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to -# do proper type resolution of all parameters of a function it will reject a -# match between the prototype and the implementation of a member function even -# if there is only one candidate or it is obvious which candidate to choose -# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen -# will still accept a match between prototype and implementation in such cases. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or macro consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and macros in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. -# This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. The create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. -# You can optionally specify a file name after the option, if omitted -# DoxygenLayout.xml will be used as the name of the layout file. - -LAYOUT_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# The WARN_NO_PARAMDOC option can be enabled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = /Users/penn/development/declarations - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh -# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py -# *.f90 *.f *.for *.vhd *.vhdl - -FILE_PATTERNS = *.dox *.c *.cc *.cxx *.cpp *.c++ *.h *.hh *.hxx *.hpp *.h++ - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = experiments test - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = images - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. -# If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. -# Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. -# The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty or if -# non of the patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) -# and it is also possible to disable source filtering for a specific pattern -# using *.ext= (so without naming a filter). This option only has effect when -# FILTER_SOURCE_FILES is enabled. - -FILTER_SOURCE_PATTERNS = - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. -# Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. Note that when using a custom header you are responsible -# for the proper inclusion of any scripts and style sheets that doxygen -# needs, which is dependent on the configuration options used. -# It is adviced to generate a default header using "doxygen -w html -# header.html footer.html stylesheet.css YourConfigFile" and then modify -# that header. Note that the header is subject to change so you typically -# have to redo this when upgrading to a newer version of doxygen or when changing the value of configuration settings such as GENERATE_TREEVIEW! - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that -# the files will be copied as-is; there are no commands or markers available. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the stylesheet and background images -# according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. -# For instance the value 0 represents red, 60 is yellow, 120 is green, -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. -# The allowed range is 0 to 359. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of -# the colors in the HTML output. For a value of 0 the output will use -# grayscales only. A value of 255 will produce the most vivid colors. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to -# the luminance component of the colors in the HTML output. Values below -# 100 gradually make the output lighter, whereas values above 100 make -# the output darker. The value divided by 100 is the actual gamma applied, -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, -# and 100 does not change the gamma. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting -# this to NO can help when comparing the output of multiple runs. - -HTML_TIMESTAMP = YES - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated -# that can be used as input for Qt's qhelpgenerator to generate a -# Qt Compressed Help (.qch) of the generated HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to -# add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see -# -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help -# plugin. To install this plugin and make it available under the help contents -# menu in Eclipse, the contents of the directory containing the HTML and XML -# files needs to be copied into the plugins directory of eclipse. The name of -# the directory within the plugins directory should be the same as -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before -# the help appears. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have -# this name. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values -# (range [0,1..20]) that doxygen will group on one line in the generated HTML -# documentation. Note that a value of 0 will completely suppress the enum -# values from appearing in the overview section. - -ENUM_VALUES_PER_LINE = 4 - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list. - -USE_INLINE_TREES = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open -# links to external symbols imported via tag files in a separate window. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are -# not supported properly for IE 6.0, but are supported on all modern browsers. -# Note that when changing this option you need to delete any form_*.png files -# in the HTML output before the changes have effect. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax -# (see http://www.mathjax.org) which uses client side Javascript for the -# rendering instead of using prerendered bitmaps. Use this if you do not -# have LaTeX installed or if you want to formulas look prettier in the HTML -# output. When enabled you also need to install MathJax separately and -# configure the path to it using the MATHJAX_RELPATH option. - -USE_MATHJAX = NO - -# When MathJax is enabled you need to specify the location relative to the -# HTML output directory using the MATHJAX_RELPATH option. The destination -# directory should contain the MathJax.js script. For instance, if the mathjax -# directory is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the -# mathjax.org site, so you can quickly see the result without installing -# MathJax, but it is strongly recommended to install a local copy of MathJax -# before deployment. - -MATHJAX_RELPATH = http://www.mathjax.org/mathjax - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets -# (GENERATE_DOCSET) there is already a search function so this one should -# typically be disabled. For large projects the javascript based search engine -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. - -SEARCHENGINE = YES - -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a PHP enabled web server instead of at the web client -# using Javascript. Doxygen will generate the search PHP script and index -# file to put on the web server. The advantage of the server -# based approach is that it scales better to large projects and allows -# full text search. The disadvantages are that it is more difficult to setup -# and does not have live searching capabilities. - -SERVER_BASED_SEARCH = NO - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = YES - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. -# Note that when enabling USE_PDFLATEX this option is only used for -# generating bitmaps for formulas in the HTML output, but not in the -# Makefile that is written to the output directory. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4 - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for -# the generated latex document. The footer should contain everything after -# the last chapter. If it is left blank doxygen will generate a -# standard footer. Notice: only use this tag if you know what you are doing! - -LATEX_FOOTER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. -# This is useful -# if you want to understand what is going on. -# On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# pointed to by INCLUDE_PATH will be searched when a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition that -# overrules the definition found in the source code. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all references to function-like macros -# that are alone on a line, have an all uppercase name, and do not end with a -# semicolon, because these will confuse the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option also works with HAVE_DOT disabled, but it is recommended to -# install and use dot, since it yields more powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is -# allowed to run in parallel. When set to 0 (the default) doxygen will -# base this on the number of processors available in the system. You can set it -# explicitly to a value larger than 0 to get control over the balance -# between CPU load and processing speed. - -DOT_NUM_THREADS = 0 - -# By default doxygen will write a font called Helvetica to the output -# directory and reference it in all dot files that doxygen generates. -# When you want a differently looking font you can specify the font name -# using DOT_FONTNAME. You need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. - -DOT_FONTNAME = Helvetica - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will generate a graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are svg, png, jpg, or gif. -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MSCFILE_DIRS tag can be used to specify one or more directories that -# contain msc files that are included in the documentation (see the -# \mscfile command). - -MSCFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES diff --git a/trick_source/sim_services/DataTypes/include/AllocInfo.hh b/trick_source/sim_services/DataTypes/include/AllocInfo.hh deleted file mode 100644 index 950c287c9..000000000 --- a/trick_source/sim_services/DataTypes/include/AllocInfo.hh +++ /dev/null @@ -1,190 +0,0 @@ -#ifndef ALLOCINFO_HH -#define ALLOCINFO_HH - -#include -#include -#include - -class DataType; -class CompositeDataType; -class ArrayDataType; -class TypeDictionary; -class ChkPtAgent; -class MemMgr; -class LexicalAnalyzer; -struct VarAccessInfo; - - -// FIXME: the follow define should be in a more appropriate place. -#define TRICK_MAX_INDEX 8 - -namespace StorageClass { - enum e { - LOCAL = 0, - EXTERN = 1 - }; -}; - -/** - * The AllocInfo class describes a chunk of memory that the MemoryManager knows about. - */ - -class AllocInfo { - - public: - /** - AllocInfo constructor. - @param varName The given name of the allocation . - @param typeSpecName - @param dimensionsCount - @param dimensions - @param typeDictionary - @param suppliedAllocation - */ - AllocInfo( const std::string& varName, - const std::string& typeSpecName, - unsigned int dimensionsCount, - int* dimensions, - TypeDictionary* typeDictionary, - void* suppliedAllocation = 0) ; - /** - AllocInfo destructor. - */ - AllocInfo( const std::string& declaration, - TypeDictionary* typeDictionary, - void* suppliedAllocation = 0) ; - /** - AllocInfo destructor. - */ - ~AllocInfo(); - - /** - @return the name given to the allocation. - Tested in: AllocInfoTest::getters1 AllocInfoTest::getters2. - */ - std::string getName() const; - - std::string getSerialName() const; - unsigned int getSerialNumber() const; - - /** - @return the starting address of the allocation. - Tested in: AllocInfoTest::getters1, AllocInfoTest::getters2. - */ - void * getStart() const; - - /** - @return the size of the allocation in bytes. - Tested in: AllocInfoTest::getters1, AllocInfoTest::getters2. - */ - int getSize() const; - - /** - @return the type specifier. - Tested in: AllocInfoTest::getters1, AllocInfoTest::getters2. - */ - std::string getTypeSpecifierName() const; - - /** - @return the number of dimensions. - Tested in: AllocInfoTest::getters1, AllocInfoTest::getters2. - */ - unsigned int getDimensionsCount() const; - - /** - @param n index of the dimension. - @return the size of the nth dimension. - Tested in: AllocInfoTest::getters1, AllocInfoTest::getters2. - */ - int getDimensionSize( unsigned int n ) const; - - /** - @return the DataType for the allocation. - Tested in: AllocInfoTest::getters1, AllocInfoTest::getters2. - */ - const DataType * getDataType() const; - - /** - @return the size of the nth dimension. - Tested in: AllocInfoTest::getters1, AllocInfoTest::getters2. - */ - StorageClass::e getStorageClass() const; - - /** - Clear the every element of the allocation to 0. - Tested in: AllocInfoTest::clear. - */ - void clear() const; - - /** - */ - void* resize( size_t newElementCount ); - - /** - @return true, if the allocation contains the given address. Otherwise return false. - Tested in: FIXME - */ - bool contains(void* address) const; - - /** - */ - bool getVarAccessInfo( LexicalAnalyzer* lexer, VarAccessInfo& varAccessInfo ); - - /** - Add this and the dependencies of this to the vector if they are not already there. - Tested in: FIXME - */ - void appendDependencies( MemMgr* memMgr, - std::vector& dependencies ) ; - - /** - Tested in: FIXME - */ - void appendDependenciesfromComposite( const CompositeDataType * compDataType, - void *address, - MemMgr* memMgr, - std::vector& dependencies) ; - - /** - Tested in: FIXME - */ - void appendDependenciesfromArray( const ArrayDataType* arrayDataType, - void* address, - MemMgr* memMgr, - std::vector& dependencies) ; - /** - Tested in: FIXME - */ - std::string toString() const; - - - private: - - void initialize( const std::string& varName, - const std::string& typeSpecName, - unsigned int dimensionsCount, - int * dimensions, - TypeDictionary* typeDictionary, - void* suppliedAllocation ) ; - - std::string name; /**< ** Object name */ - void* start; /**< ** Address where this allocation starts */ - void* end; /**< ** Address where this allocation ends */ - - /* The following three data members describe the type and are used to create the data type below. */ - std::string typeSpecifierName; /**< ** Type-specifier */ - unsigned int dimensionsCount; /**< ** The number of dimensions */ - int dimensions[TRICK_MAX_INDEX]; /**< ** Size of each dimension */ - - ArrayDataType* ownDataType; /**< ** */ - const DataType* dataType; /**< ** */ - - StorageClass::e storageClass; /**< ** Storage class */ - - unsigned int serialNumber; - static unsigned int nextSerialNumber; - - static const std::string localPrefix; - static const std::string externPrefix; -} ; -#endif diff --git a/trick_source/sim_services/DataTypes/include/ArrayDataType.hh b/trick_source/sim_services/DataTypes/include/ArrayDataType.hh deleted file mode 100644 index a357de1d2..000000000 --- a/trick_source/sim_services/DataTypes/include/ArrayDataType.hh +++ /dev/null @@ -1,158 +0,0 @@ -#ifndef ARRAY_DATA_TYPE_HH -#define ARRAY_DATA_TYPE_HH - -#include "DataType.hh" -#include -#include -#include -#include - -#define MAX_CONSTRAINED_DIMS 8 - -class LexicalAnalyzer; - -/** - */ -class ArrayDataType : public DataType { - - public: - /** - Constructor for ArrayDataType. - @param typeSpecifierName Name of the type on with this type is based. - @param n_ptrs Number of pointers. - @param n_cdims Number of dimensions. Cannot be 0. - @param dims dimension sizes. - */ - ArrayDataType( TypeDictionary* typeDictionary, - std::string typeSpecifierName, - unsigned int n_dims, - int dims[] ) ; - /** - Constructor for ArrayDataType. - @param typeDictionary The Type Dictionary. - @param typeSpecifierName Name of the type on with this type is based. - @param dims dimension sizes. - */ - ArrayDataType( TypeDictionary* typeDictionary, - std::string typeSpecName, - unsigned int dimensionSize ) ; - - /** - Create an ArrayDataType with a different elementCount, but otherwise - identical to the original. - */ - ArrayDataType ( const ArrayDataType & original, unsigned int newSize ); - - /* ==================================================================== */ - /* RULE OF THREE INTERFACE */ - /* ==================================================================== */ - - /** - Copy Constructor for ArrayDataType. - */ - ArrayDataType ( const ArrayDataType & original ); - - /** - Destructor for ArrayDataType. - */ - ~ArrayDataType (); - - /** - Assignment operator for ArrayDataType. - @param rhs right-hand-side. - */ - ArrayDataType& operator=( const ArrayDataType & rhs ); - - /* ==================================================================== */ - /* VIRTUAL INTERFACE */ - /* ==================================================================== */ - - /** - */ - bool containsPointers() const; - - /** - */ - DataType * clone () const; - - /** - */ - bool validate(); - - /** - @return The size (in bytes) of an instance of the ArrayDataType. - */ - size_t getSize() const ; - - TypeClass::e getTypeClass() const { - return TypeClass::ARRAY; - } - - /** - @return The number of arrayed Type-specifier elements of the DataType. - */ - unsigned int getTotalElementCount() const; - - /** - */ - void* createInstance(unsigned int num) const ; - - /** - */ - void deleteInstance(void* address) const; - - /** - */ - void clearValue(void * address) const; - - /** - */ - void assignValue(void * address, Value * value) const; - - /** - @param s The stream to print to. - @param base_addr Address of the (entire) variable. - */ - void printValue(std::ostream &s, void * address ) const; - - /** - */ - std::string getTypeSpecName() const; - - /** - */ - std::string makeDeclaration(std::string declarator, bool isDirectDeclarator) const; - - /* ==================================================================== */ - /* CLASS SPECIFIC INTERFACE */ - /* ==================================================================== */ - - /** - */ - bool getElementInfo( LexicalAnalyzer* lexer, void* baseAddress, VarAccessInfo& varAccessInfo); - - /** - @return 0 if the ArrayDataType represents a pointer, - otherwise return the number of elements in the array. - */ - unsigned int getElementCount() const; - - /** - */ - const DataType * getSubType() const; - - - private: - bool initArrayDataType( TypeDictionary* typeDictionary, std::string typeSpecName, unsigned int n_dims, int dims[] ); - ArrayDataType(){} - - size_t typeSize; - unsigned int elementCount; - bool is_valid; - std::string typeSpecName; - DataType * ownDataType; - const DataType * subType; - TypeDictionary* typeDictionary; - -}; -#endif diff --git a/trick_source/sim_services/DataTypes/include/BitfieldStructMember.hh b/trick_source/sim_services/DataTypes/include/BitfieldStructMember.hh deleted file mode 100644 index 12a8b334c..000000000 --- a/trick_source/sim_services/DataTypes/include/BitfieldStructMember.hh +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef BITFIELD_STRUCT_MEMBER_H -#define BITFIELD_STRUCT_MEMBER_H - -#include "StructMember.hh" -#include "IntegerValue.hh" -#include -#include - - -/** - BitfieldStructMember represents a bitfield data-member of a CompositeDeclaration. - */ -template -class BitfieldStructMember : public StructMember { - - public: - - /** - Constructor for BitfieldStructMember. - @param name Name of the data-member. - @param getter Pointer to function that gets the bitfield value. - @param setter Pointer to function that gets the bitfield value. - */ - BitfieldStructMember( std::string name, - T(*getter)(void* address), - void(*setter)(void* address, T value)) - : StructMember(name) { - - get_bitfield_value = getter; - set_bitfield_value = setter; - } - - /** - Copy Constructor. - */ - BitfieldStructMember ( const BitfieldStructMember & original) : StructMember( original ) { - - get_bitfield_value = original.get_bitfield_value; - set_bitfield_value = original.set_bitfield_value; - } - - /** - Clone. - */ - StructMember * clone () const { - return new BitfieldStructMember( *this ); - } - - /** - */ - bool validate() { return true; } - - /** - */ - MemberClass::e getMemberClass() const { - return MemberClass::BITFIELD; - } - - /** - Operator= - */ - BitfieldStructMember & operator=(const BitfieldStructMember & rhs) { - BitfieldStructMember * decl; - decl = new BitfieldStructMember( rhs ); - return *decl; - } - - /** - Destructor - */ - ~BitfieldStructMember() { /* Nothing to do */ } - - /** - */ - void clearValue(void *struct_address) const { - (*set_bitfield_value)(struct_address, 0); - } - - /** - */ - void assignValue(void *struct_address, Value *v) const { - IntegerValue * integer_value_p = dynamic_cast(v); - if (integer_value_p) { - T rvalue = integer_value_p->getIntegerValue(); - - (*set_bitfield_value)( struct_address, rvalue ); - - } else { - std::cerr << "ERROR: Attempt to assign non-integer value to a bitfield."; - } - } - - /** - */ - void printValue(std::ostream &s, void *struct_address) const { - - T value = (*get_bitfield_value)( struct_address ); - s << value ; - } - - std::string getTypeSpecName() const { - std::string s(""); - return s; - } - - /** - */ - std::string toString() const { - std::ostringstream oss; - oss << getTypeSpecName() << " " << getName() << " : BITFIELD"; - return oss.str(); - } - - private: - T (* get_bitfield_value)(void* addr); - void (* set_bitfield_value)(void* addr, T value); -}; - #endif diff --git a/trick_source/sim_services/DataTypes/include/ChkPtAgent.hh b/trick_source/sim_services/DataTypes/include/ChkPtAgent.hh deleted file mode 100644 index b6c881c1d..000000000 --- a/trick_source/sim_services/DataTypes/include/ChkPtAgent.hh +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef CHKPTAGENT_HH -#define CHKPTAGENT_HH - -#include -#include - -class AllocInfo; -class DataType; -class MemMgr; - -/** - Base Class for dumping a checkpoint. - */ - class ChkPtAgent { - - public: - - /** - */ - virtual ~ChkPtAgent() {}; - - /** - Push base name onto the left-side name stack. - */ - virtual void pushName( const std::string& name ) = 0; - - /** - Push array element index onto the left-side name stack. - */ - virtual void pushIndex( int index ) = 0; - - /** - Pop element from the left-side name stack; - */ - virtual void popNameElement() = 0; - - /** - Write a declaration that describes the given ALLOC_INFO object. - @return whether an error-condition has happened. - */ - virtual bool writeDeclaration( std::ostream& chkpnt_os, - std::string name, - const DataType * dataType) = 0; - /** - @return whether an error-condition has happened. - */ - virtual bool writeVariable( std::ostream& out_s, - MemMgr* memMgr, - void* address, - const DataType* dataType ) = 0; - /** - Restore Checkpoint. - */ - virtual int restore( std::istream* checkpoint_stream) = 0; - - }; -#endif diff --git a/trick_source/sim_services/DataTypes/include/ClassicChkPtAgent.hh b/trick_source/sim_services/DataTypes/include/ClassicChkPtAgent.hh deleted file mode 100644 index c399e3380..000000000 --- a/trick_source/sim_services/DataTypes/include/ClassicChkPtAgent.hh +++ /dev/null @@ -1,153 +0,0 @@ -#ifndef CLASSIC_CHKPTAGENT_HH -#define CLASSIC_CHKPTAGENT_HH - -#include "ChkPtAgent.hh" -#include -#include -#include - -class ArrayDataType; -class PointerDataType; -class CompositeDataType; - -/** - Base Class for dumping a checkpoint. - */ - class ClassicChkPtAgent : public ChkPtAgent { - - public: - - /** - */ - ClassicChkPtAgent( std::ostream& errs ) : errorStream(errs) { - reducedCheckpoint = true; - hexfloatCheckpoint = false; - makeCompactArrays = true; - debugLevel = 0; - }; - - /** - */ - ~ClassicChkPtAgent() {}; - - /** - Push base name onto the left-side name stack. - Tested in: ClassicChkPtAgentTest::nameStackFunctions. - */ - void pushName( const std::string& name ); - - /** - Push array element index onto the left-side name stack. - Tested in: ClassicChkPtAgentTest::nameStackFunctions. - */ - void pushIndex( int index ); - - /** - Pop element from the left-side name stack; - Tested in: ClassicChkPtAgentTest::nameStackFunctions. - */ - void popNameElement(); - - /** - @return the current name in the left-side-name stack. - Tested in: ClassicChkPtAgentTest::nameStackFunctions. - */ - std::string getLeftSideName(); - - /** - Write a declaration that describes the data-type of the given AllocInfo object. - */ - bool writeDeclaration( std::ostream& out_s, - std::string name, - const DataType * dataType ); - - //bool writeDeclaration( std::ostream& out_s, const std::string& name, const DataType* dataType ); - - /** - Write a list of assignment statements that describe the contents of the - object, of the given data-type, at the given address. - */ - bool writeVariable( std::ostream& out_s, - MemMgr * memMgr, - void * address, - const DataType * dataType ); - /** - Restore Checkpoint. - */ - int restore( std::istream* checkpoint_stream); - - /** - Checkpoint writing utilities. - */ - bool writeArrayAssignments( std::ostream& out_s, - MemMgr * memMgr, - void * address, - const ArrayDataType * arrayDataType); - - /** - */ - bool writePointerValue( std::ostream& out_s, - MemMgr * memMgr, - void * address, - const PointerDataType * pointerDataType); - - /** - */ - bool writeCompositeAssignments( std::ostream& out_s, - MemMgr * memMgr, - void * address, - const CompositeDataType * compDataType); - - /** - Tested in: ClassicChkPtAgentTest::writeAssignment. - */ - void writeAssignment( std::ostream& out_s, - std::string rhs); - - /** - Tested in: ClassicChkPtAgentTest::getSubName1, - ClassicChkPtAgentTest::getSubName2, - ClassicChkPtAgentTest::getSubName3. - */ - bool getSubName( std::ostream& nameStream, - void * searchAddress, - const DataType * searchType, - void * baseAddress, - const DataType * baseType ); - - /** - Tested in: ClassicChkPtAgentTest::getSubName1, - ClassicChkPtAgentTest::getSubName2, - ClassicChkPtAgentTest::getSubName3. - */ - bool getCompositeSubName( std::ostream& nameStream, - void * searchAddress, - const DataType * searchType, - void * baseAddress, - const CompositeDataType * baseType ); - /** - Tested in: ClassicChkPtAgentTest::getSubName2, - ClassicChkPtAgentTest::getSubName3. - */ - bool getArraySubName( std::ostream& nameStream, - void * searchAddress, - const DataType * searchType, - void * baseAddress, - const ArrayDataType * baseType ); - - void setReducedCheckpoint(bool flag); - void setHexfloatCheckpoint(bool flag); - void setMakeCompactArrays(bool flag); - void setDebugLevel(int level); - - private: - - std::ostream& errorStream; - bool reducedCheckpoint; /**< ** Reduced Checkpoint flag. */ - bool hexfloatCheckpoint; /**< ** HexFloat Checkpoint flag. */ - bool makeCompactArrays; /**< ** . */ - int debugLevel; /**< ** Debug Level. */ - - std::vector leftSideNameStack; - }; -#endif diff --git a/trick_source/sim_services/DataTypes/include/CompositeDataType.hh b/trick_source/sim_services/DataTypes/include/CompositeDataType.hh deleted file mode 100644 index 668f94189..000000000 --- a/trick_source/sim_services/DataTypes/include/CompositeDataType.hh +++ /dev/null @@ -1,188 +0,0 @@ -#ifndef COMPOSITE_DATA_TYPE_H -#define COMPOSITE_DATA_TYPE_H - -#include "DataType.hh" -#include "StructMember.hh" -#include "BitfieldStructMember.hh" -#include "Value.hh" -#include "VarAccessInfo.hh" -#include -#include -#include - -class LexicalAnalyzer; - -/** - A CompositeDataType represents user-defined types, such as structs, unions, or classes. - It is 'composed' of ordered lists of component types. - */ -class CompositeDataType : public DataType { - -public: - - /** - Constructor for CompositeDataType. - @param sizeof_struct Size, in bytes, of the struct, class or union that this class represents. - */ - CompositeDataType( TypeDictionary* typeDictionary, - std::string name, - size_t sizeof_struct, - void *(*allocator)(int), - void (*deAllocator)(void*) ); - - /* ==================================================================== */ - /* RULE OF THREE INTERFACE */ - /* ==================================================================== */ - - /** - Copy Constructor. - @param original The instance of CompositeDataType that is to be copied. - */ - CompositeDataType ( const CompositeDataType & original ); - - /** - Destructor for CompositeDataType. - */ - ~CompositeDataType (); - - /** - Assignment operator for CompositeDataType. - @param rhs right-hand-side. - */ - CompositeDataType & operator=( const CompositeDataType & rhs ); - - /* ==================================================================== */ - /* VIRTUAL INTERFACE */ - /* ==================================================================== */ - - /** - @return does the DataType or any member of the DataType represent a pointer? - */ - bool containsPointer() const; - - /** - */ - DataType * clone() const; - - /** - */ - bool validate() ; - - /** - @return The size (in bytes) of an instance of the CompositeDataType. - */ - size_t getSize() const ; - - /** - */ - TypeClass::e getTypeClass() const { - return TypeClass::COMPOSITE; - }; - - /** - */ - void* createInstance(unsigned int num) const; - - /** - */ - void deleteInstance(void* address) const; - - /** - */ - void clearValue(void * address) const; - - /** - Assign a value to the variable at the given address. - @param address Base-address of the (possibly arrayed) variable. - @param value The Value to be assigned to the element. - */ - void assignValue(void * address, Value * value) const; - - /** - Print the value at the given address, to the given stream. - @param s The stream to print to. - @param address Address of the (entire) variable. - */ - void printValue(std::ostream &s, void *address) const; - - /** - */ - std::string toString() const; - - /* ==================================================================== */ - /* CLASS SPECIFIC INTERFACE */ - /* ==================================================================== */ - - /** - Add a regular, non-bitfield, non-static data member to the CompositeDataType. - @param memberName Name of the data member. - @param offset The offset (in bytes) of the data-member from the beginning of - the struct, union or class. - @param typeName - @param n_dims - @param dims - */ - void addRegularMember( std::string memberName, - int offset, - std::string typeName, - unsigned n_dims, - int dims[]) ; - - /** - Add a static data member to the CompositeDataType. - @param memberName Name of the data member. - @param memberAddress The offset (in bytes) of the data-member from the beginning of - the struct, union or class. - @param typeName - @param n_dims - @param dims - */ - void addStaticMember(std::string memberName, - void * memberAddress, - std::string typeSpecName, - unsigned int n_dims, - int dims[] ) ; - - /** - Add a bitfield data member to the CompositeDataType. - @param member_name Name of the data member. - @param getter Pointer to a function that returns the value of a bitfield in the addressed class/struct. - @param getter Pointer to a function that sets the value of a bitfield in the addressed class/struct. - */ - template void addBitFieldMember( std::string member_name, - T(*getter)(void* address), - void(*setter)(void* address, T value) ) { - - memberList.push_back( new BitfieldStructMember(member_name, getter, setter)); - - } - - /** - */ - std::string getTypeSpecName() const; - - /** - */ - int getMemberCount() const; - - /** - */ - StructMember* getStructMember (const int index) const; - - /** - */ - bool getMemberInfo( LexicalAnalyzer* lexer, void* baseAddress, VarAccessInfo& varAccessInfo ); - -private: - CompositeDataType(); - - bool is_valid; - std::vector memberList; - std::vector::iterator memberListIterator; - std::string name; - size_t structSize; /** Sizeof the struct/or class represented by the CompositeDataType. */ - void* (*allocator)(int); - void (*deAllocator)(void*); - TypeDictionary* typeDictionary; -}; -#endif diff --git a/trick_source/sim_services/DataTypes/include/CompositeValue.hh b/trick_source/sim_services/DataTypes/include/CompositeValue.hh deleted file mode 100644 index 620af743b..000000000 --- a/trick_source/sim_services/DataTypes/include/CompositeValue.hh +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef COMPOSITE_VALUE_H -#define COMPOSITE_VALUE_H - -#include "Value.hh" -#include - -/** - CompositeValue is a Value composed of Value (s). - */ -class CompositeValue : public Value { - - public: - - /** - Destroy this CompositeValue. - */ - ~CompositeValue(); - - /** - Add a member to this CompositeValue. - */ - void addMember(Value* value); - - /** - Get the number of members in this CompositeValue. - @return the number of members in this CompositeValue. - */ - int getMemberCount(); - - /** - Get reference to the component Value at the given index. - */ - Value*& operator[] (const int index); - - /** - Print this CompositeValue to a stream. - */ - void print(std::ostream &s); - - /** - Get a string representation of this CompositeValue. - */ - std::string toString(); - - private: - std::vector member_list; -}; -#endif diff --git a/trick_source/sim_services/DataTypes/include/DataType.hh b/trick_source/sim_services/DataTypes/include/DataType.hh deleted file mode 100644 index af29b543f..000000000 --- a/trick_source/sim_services/DataTypes/include/DataType.hh +++ /dev/null @@ -1,114 +0,0 @@ -#ifndef DATA_TYPE_HH -#define DATA_TYPE_HH - -#include -#include - -class Value; -class TypeDictionary; - -namespace TypeClass { - enum e { - PRIMITIVE = 0, - ENUMERATION = 1, - POINTER = 2, - ARRAY = 3, - COMPOSITE = 4 - }; -}; - -/** @brief Abstract base class for DataTypes. */ -class DataType { - - public: - - virtual ~DataType() {} - - /** - Verify that all of the types that are named by this DataType or - subordinate DataTypes are resolvable to actual DataTypes in - the TypeDictionary. - */ - virtual bool validate() = 0; - - /** - @return The size (in bytes) of an instance of the DataType. - */ - virtual size_t getSize() const = 0; - - /** - @return An enumeration value indicating which of the several specific subclasses of DataType this class is. - */ - virtual TypeClass::e getTypeClass() const = 0; - - /** - */ - virtual std::string getTypeSpecName() const = 0; - - /** - @return The number of arrayed Type-specifier elements of the DataType. - FIXME: THIS LOOKS HINKY and IS ARRAY SPECIFIC - */ - virtual unsigned int getTotalElementCount() const { return 1; } - - /** - @return does the DataType or any member of the DataType represent a pointer? - */ - virtual bool containsPointers() const { return false; } - - /** - @return a duplicate DataType. - */ - virtual DataType * clone () const = 0; - - /** - */ - virtual void* createInstance(unsigned int n ) const = 0; - - /** - */ - virtual void deleteInstance(void* address) const = 0; - - /** - Clear the variable at the given address. - @param address Address of the variable. - */ - virtual void clearValue(void * address) const = 0; - - /** - Assign a value to the variable at the given address. - @param address Address of the variable. - @param value Value to be assigned to the element. - */ - virtual void assignValue(void * address, Value * value) const = 0; - - /** - Print the value of the variable at the given address to the given stream. - @param s The stream to print to. - @param address Address of the variable. - */ - virtual void printValue(std::ostream &s, void *address) const = 0; - - /** - Generate a declaration of this DataType. - @param declarator A declarator, which can be a - 1) a variable name or an array declarator (both are direct-declarators) or - 2) a pointer declarator ( not a direct-declarator ). - @param isDirectDeclarator true indicates a variable-name or array-declarator; false indicates a pointer-declarator. - */ - virtual std::string makeDeclaration(std::string declarator, bool isDirectDeclarator) const; - - /** - Generate a definition of this DataType. - */ - virtual std::string toString() const; - - /** - @return true it this DataType represents void or false otherwise. - */ - virtual bool isVoid() const { return false; } - - private: -}; - -#endif diff --git a/trick_source/sim_services/DataTypes/include/EnumDataType.hh b/trick_source/sim_services/DataTypes/include/EnumDataType.hh deleted file mode 100644 index 6a424418e..000000000 --- a/trick_source/sim_services/DataTypes/include/EnumDataType.hh +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef ENUM_DATA_TYPE_HH -#define ENUM_DATA_TYPE_HH - -#include "DataType.hh" -#include "Enumerator.hh" -#include "EnumDictionary.hh" -#include "Value.hh" -#include -#include - -/** - An EnumDataType represents an enumeration type. -*/ -class EnumDataType : public DataType { - -public: - - /** - Constructor for EnumDataType. - @param sizeof_element Size, in bytes, of one eneumeration element. - */ - EnumDataType( EnumDictionary* enumDictionary, - std::string name, - size_t sizeof_element); - - /* ==================================================================== */ - /* RULE OF THREE INTERFACE */ - /* ==================================================================== */ - - /** - Copy Constructor. - @param original The instance of EnumDataType that is to be copied. - */ - EnumDataType ( const EnumDataType & original ); - - /** - Destructor for EnumDataType. - */ - ~EnumDataType (); - - /** - Assignment operator for EnumDataType. - @param rhs right-hand-side. - */ - EnumDataType & operator=( const EnumDataType & rhs ); - - /* ==================================================================== */ - /* VIRTUAL INTERFACE */ - /* ==================================================================== */ - - /** - */ - DataType * clone() const ; - - /** - */ - bool validate(); - - /** - */ - TypeClass::e getTypeClass() const { - return TypeClass::ENUMERATION; - } - - /** - @return The size (in bytes) of an instance of the EnumDataType. - */ - size_t getSize() const; - - /** - */ - void* createInstance(unsigned int num) const; - - /** - */ - void deleteInstance(void* address) const; - - /** - */ - void clearValue(void * address) const; - - /** - Assign a value to the (unarrayed) element at the given base-address and - offset, where the offset is in the final dimension. - @param address Base-address of the (possibly arrayed) variable. - @param offset Offset, in the final dimension, to the particular element - being assigned. - @param value The Value to be assigned to the element. - */ - void assignValue(void * address, Value * value) const; - - /** - Print the value of the element at the given base-address and offset, to the - given stream. - @param s The stream to print to. - @param base_addr Address of the (entire) variable. - @param offset Offset to the element, in the final dimension of the variable. - */ - void printValue(std::ostream &s, void *base_addr) const; - - /** - */ - std::string toString() const; - - /** - Get the name of the enumeration type. - */ - std::string getTypeSpecName() const; - - /* ==================================================================== */ - /* CLASS SPECIFIC INTERFACE */ - /* ==================================================================== */ - - /** - Add a regular, non-bitfield data member to the EnumDataType. - @param member_name Name of the data member. - @param offset The offset (in bytes) of the data-member from the beginning of - the struct, union or class. - @param type_decl TypeDeclaration of the data-member. - */ - void addEnumerator( std::string member_name, int value) ; - -private: - EnumDataType() {}; - std::vector enum_list; - size_t enumSize; - EnumDictionary * enumDictionary; - std::string name; -}; -#endif diff --git a/trick_source/sim_services/DataTypes/include/EnumDictionary.hh b/trick_source/sim_services/DataTypes/include/EnumDictionary.hh deleted file mode 100644 index 59624a72a..000000000 --- a/trick_source/sim_services/DataTypes/include/EnumDictionary.hh +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef ENUM_DICTIONARY_H -#define ENUM_DICTIONARY_H - -#include -#include -#include - -/** - EnumDictionary is a container classes that stores pairs. - */ -class EnumDictionary { - -public: - - EnumDictionary () {}; - - /** - Add a name/value pair to the dictionary. - */ - void addEnumerator(std::string name, int value) ; - - /** - Get the value associated with the given string.i FIXME: what of string not found? - */ - int getValue(std::string name) ; - - /** - */ - std::string toString(); - - /** - Destructor for EnumDictionary. - */ - ~EnumDictionary() {} - -private: - std::map enumDictionary; - std::map::iterator enumDictionaryIterator; -}; -#endif diff --git a/trick_source/sim_services/DataTypes/include/Enumerator.hh b/trick_source/sim_services/DataTypes/include/Enumerator.hh deleted file mode 100644 index 47ee075ad..000000000 --- a/trick_source/sim_services/DataTypes/include/Enumerator.hh +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef ENUMERATOR_H -#define ENUMERATOR_H - -#include - -class Enumerator { - -public: - Enumerator(std::string name, int value); - Enumerator( const Enumerator& original); - std::string getName(); - int getValue(); - std::string toString(); - -private: - std::string name; - int value; -}; -#endif diff --git a/trick_source/sim_services/DataTypes/include/FloatingPointValue.hh b/trick_source/sim_services/DataTypes/include/FloatingPointValue.hh deleted file mode 100644 index 4a81f126a..000000000 --- a/trick_source/sim_services/DataTypes/include/FloatingPointValue.hh +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef FLOATING_POINT_VALUE_H -#define FLOATING_POINT_VALUE_H - -#include "NumericValue.hh" - -/** - */ -class FloatingPointValue : public NumericValue { - - public: - - /** - Constructor. - @param value The value of this FloatingPointValue. - */ - FloatingPointValue(double value); - - /** - Get the value of this FloatingPointValue as floating point. - @return the value as a double. - */ - double getFloatingPointValue(); - - /** - Get the value of this FloatingPointValue as an integer. - @return the value as a long long int. - */ - long long getIntegerValue(); - - /** - Print this FloatingPointValue to a stream. - */ - void print(std::ostream &s); - - /** - Get a string representation of this FloatingPointValue. - */ - std::string toString(); - - - private: - double value; -}; -#endif diff --git a/trick_source/sim_services/DataTypes/include/IntegerValue.hh b/trick_source/sim_services/DataTypes/include/IntegerValue.hh deleted file mode 100644 index a017fd14f..000000000 --- a/trick_source/sim_services/DataTypes/include/IntegerValue.hh +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef INTEGER_VALUE_H -#define INTEGER_VALUE_H - -#include "NumericValue.hh" - -/** - @brief IntegerValue is a Value that represents an integer value on the right-hand-side of an equation. - */ -class IntegerValue : public NumericValue { - - public: - - /** - Constructor. - @param value The value of this IntegerValue. - */ - IntegerValue(long long value); - - /** - Get the value of the IntegerValue as floating point. - @return the value as a double. - */ - double getFloatingPointValue(); - - /** - Get the value of this IntegerValue as an integer. - @return the value as a long long int. - */ - long long getIntegerValue(); - - /** - Print this FloatingPointValue to a stream. - */ - void print(std::ostream &s); - - /** - Get a string representation of this IntegerValue. - */ - std::string toString(); - - private: - long long value; -}; -#endif diff --git a/trick_source/sim_services/DataTypes/include/LexicalAnalyzer.hh b/trick_source/sim_services/DataTypes/include/LexicalAnalyzer.hh deleted file mode 100644 index a55a324d9..000000000 --- a/trick_source/sim_services/DataTypes/include/LexicalAnalyzer.hh +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef LEXICAL_ANALYZER_HH -#define LEXICAL_ANALYZER_HH - -#include -#include - -namespace Token { - enum e { - Error = 0, - EndOfFile = 1, - Identifier = 2, - Void = 3, - Boolean = 4, - Char = 5, - Short = 6, - Int = 7, - Long = 8, - WideChar = 9, - Signed = 10, - Unsigned = 11, - Float = 12, - Double = 13, - LeftParen = 14, - RightParen = 15, - LeftBracket = 16, - RightBracket = 17, - Asterisk = 18, - Integer = 19 - }; -}; - -class LexicalAnalyzer { - - public: - LexicalAnalyzer(); - void load( const std::string& s ); - Token::e getToken(); - Token::e nextToken(); - Token::e matchToken(Token::e expectedToken ); - std::string getText(); - Token::e token; - - private: - char nextChar; - std::stringstream inStream; - std::string lexemeText; -}; - -#endif diff --git a/trick_source/sim_services/DataTypes/include/MemMgr.hh b/trick_source/sim_services/DataTypes/include/MemMgr.hh deleted file mode 100644 index 20abcb999..000000000 --- a/trick_source/sim_services/DataTypes/include/MemMgr.hh +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef MEMMGR_HH -#define MEMMGR_HH - -#include -#include -#include -#include - -class AllocInfo; -class DataType; -class TypeDictionary; -class ChkPtAgent; -class ClassicChkPtAgent; - -class MemMgr { - - public: - MemMgr(); - - void* declare_var( const std::string& typeSpecName, const std::string& varName, unsigned int DimensionsCount, int *Dimensions, void* suppliedAllocation = 0); - void* declare_var( const std::string& declaration, void* suppliedAllocation = 0); - void* declare_var( const std::string& typeSpecName, int n, void* suppliedAllocation = 0); - void* declare_var( const std::string& typeSpecName, const std::string& varName, int n, void* suppliedAllocation = 0); - -// void* declare_extern_var( void* address, const char * declaration); -// void* declare_extern_var( void* address, const char *element_definition, int n_elems); -// void* declare_extern_var( void* address, TRICK_TYPE type, std::string class_name, int n_stars, std::string var_name, int n_cdims, int *cdims); - - void* resize_var( void* address, size_t newElementCount); - void* resize_var( const std::string& name, size_t newElementCount); - -// char* mm_strdup( const char* s); - - bool var_exists( const std::string& var_name); -// size_t sizeof_type( const char* declaration); -// int is_alloced( void* address); -// void set_debug_level( int level); -// void set_reduced_checkpoint(bool flag); -// void set_hexfloat_checkpoint(bool flag); - void clear_var( void* address); - void clear_var( const std::string& var_name); - void clear_all_vars(); - -// int delete_var(void* address, bool destroy = true); -// int delete_var(const char* var_name); -// int delete_extern_var(void* address); -// int delete_extern_var(const char* var_name); - -// void write_var( std::ostream& out_s, const char* var_name ); -// void write_var( std::ostream& out_s, void* address ); - - void write_checkpoint( std::ostream& out_s); - void write_checkpoint( const std::string& filename); - void write_checkpoint( std::ostream& out_s, const std::string& variableName ); - void write_checkpoint( const std::string& filename, const std::string& variableName); - void write_checkpoint( std::ostream& out_s, std::vector& variableNameList); - void write_checkpoint( const std::string& filename, std::vector& variableNameList); - void write_checkpoint(std::ostream& outStream, std::vector& dependencies); - -// int read_checkpoint( std::istream* in_s); -// int read_checkpoint( const char* filename); -// int read_checkpoint_from_string( const char* s ); - -// int init_from_checkpoint( std::istream* in_s); -// int init_from_checkpoint( const char* filename); - -// void reset_memory(); - -// int add_attr_info(std::string& type_name , ATTRIBUTES* attr , const char * file_name = "None" , unsigned int line_num = 0 ) ; -// int add_template_name_trans(std::string template_name , std::string attr_name) ; -// void* add_var( TRICK_TYPE type, const char* class_name, VAR_DECLARE* var_declare, char* units); -// int add_vars( TRICK_TYPE type, const char* class_name, VAR_LIST* var_list, char* units); -// int ref_allocate( REF2* R, int num ) ; -// REF2 *ref_attributes( const char* name); -// int ref_assignment( REF2* R, V_TREE* V); -// int ref_var( REF2* R, char* name); -// int ref_dim( REF2* R, V_DATA* V); -// int ref_name(REF2 * R, char *name); -// int get_enumerated(const char* name, V_DATA* v_data); (see EnumDictionary.hh) -// int get_size(char *ptr); -// int get_truncated_size(char *ptr); -// int io_get_fixed_truncated_size(char *ptr, ATTRIBUTES * A, char *str, int dims, ATTRIBUTES * left_type); - AllocInfo* getAllocInfoOf( void* address ); - AllocInfo* getAllocInfoAt( void* address ); - AllocInfo* getAllocInfoNamed( const std::string& name ); - const DataType* getDataType(std::string typeName); -// int add_shared_library_symbols( const char * file_name ); -// CheckPointAgent * get_CheckPointAgent(); -// void set_CheckPointAgent( CheckPointAgent* agent); -// void reset_CheckPointAgent(); -// void write_class( std::ostream& out_s, char *address, ATTRIBUTES * A); -// void write_arrayed_class( std::ostream& out_s, char* address, ATTRIBUTES* A, int curr_dim, int offset); -// size_t io_src_sizeof_user_type(const char* user_type_name); - - private: - unsigned int debugLevel; - - ChkPtAgent* currentCheckPointAgent; - ClassicChkPtAgent* defaultCheckPointAgent; - - bool reducedCheckpoint; - bool hexfloatCheckpoint; - bool compactArraysCheckpoint; - - TypeDictionary* typeDictionary; - - pthread_mutex_t allocInfoMapMutex; - - std::map allocInfoByAddressMap; - std::map allocInfoByNameMap; - -}; -#endif diff --git a/trick_source/sim_services/DataTypes/include/NormalStructMember.hh b/trick_source/sim_services/DataTypes/include/NormalStructMember.hh deleted file mode 100644 index 8e96a7462..000000000 --- a/trick_source/sim_services/DataTypes/include/NormalStructMember.hh +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef NORMAL_STRUCT_MEMBER_H -#define NORMAL_STRUCT_MEMBER_H - -#include "StructMember.hh" -#include "DataType.hh" -#include - -/** - */ -class NormalStructMember : public StructMember { - -public: - - /** - Constructor. - */ - NormalStructMember( std::string member_name, - int offset, - TypeDictionary* typeDictionary, - std::string typeSpecName, - unsigned int n_dims, - int dims[] ); - - /** - Copy Constructor. - */ - NormalStructMember ( const NormalStructMember & original ); - - /** - Clone. - */ - StructMember * clone () const; - - /** - Destructor. - */ - ~NormalStructMember(); - - /** - */ - bool validate(); - - /** - */ - MemberClass::e getMemberClass() const { - return MemberClass::NORMAL; - } - - /** - */ - bool containsPointers() const ; - - /** - To check for circular reference only. - */ - const DataType * getDataType(); - - /** - */ - int getOffset(); - - /** - */ - void clearValue(void *struct_address) const ; - - /** - */ - void assignValue(void *struct_address, Value *v) const ; - - /** - */ - void printValue(std::ostream &s, void *struct_address) const ; - - /** - Product a string representation of this NormalStructMember. - */ - std::string toString() const ; - -private: - int byte_offset; - bool is_valid; - std::string typeSpecName; - DataType * declDataType; - const DataType * subType; - TypeDictionary* typeDictionary; - -}; -#endif diff --git a/trick_source/sim_services/DataTypes/include/NumericValue.hh b/trick_source/sim_services/DataTypes/include/NumericValue.hh deleted file mode 100644 index 457037710..000000000 --- a/trick_source/sim_services/DataTypes/include/NumericValue.hh +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef NUMERIC_VALUE_H -#define NUMERIC_VALUE_H - -#include "Value.hh" - -/** - */ -class NumericValue : public Value { - - public: - - /** - Get the value of this NumericValue as a floating point value. - @return the value as a double. - */ - virtual double getFloatingPointValue() = 0; - - /** - Get the value of this IntegerValue as an integer. - @return the value as a long long int. - */ - virtual long long getIntegerValue() = 0; -}; - -#endif diff --git a/trick_source/sim_services/DataTypes/include/ParsedDeclaration.hh b/trick_source/sim_services/DataTypes/include/ParsedDeclaration.hh deleted file mode 100644 index 2cba35b63..000000000 --- a/trick_source/sim_services/DataTypes/include/ParsedDeclaration.hh +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef PARSED_DECLARATION_HH -#define PARSED_DECLARATION_HH - -#include -#include -#include "LexicalAnalyzer.hh" - -#define MAX_DIMS 16 - -class ParsedDeclaration { - - public: - - ParsedDeclaration( std::string s ); - std::string getTypeSpecifier(); - std::string getVariableName(); - unsigned int getNumberOfDimensions(); - int getDimensionSize( unsigned int index); - - private: - bool parseTypeSpecifier(); - bool parseDeclaration(); - bool parseDeclarator(); - bool parseDirectDeclarator(); - - bool match(Token::e expected_token); - - Token::e nextToken; - LexicalAnalyzer lexer; - - std::string typeSpec; - std::string varName; - unsigned int ndims; - int dims[MAX_DIMS]; - -}; - -#endif diff --git a/trick_source/sim_services/DataTypes/include/PointerDataType.hh b/trick_source/sim_services/DataTypes/include/PointerDataType.hh deleted file mode 100644 index d51095511..000000000 --- a/trick_source/sim_services/DataTypes/include/PointerDataType.hh +++ /dev/null @@ -1,131 +0,0 @@ -#ifndef POINTER_DATA_TYPE_HH -#define POINTER_DATA_TYPE_HH - -#include "DataType.hh" -#include -#include -#include - -/** - */ -class PointerDataType : public DataType { - - public: - - /** - Constructor for PointerDataType. - @param typeDictionary The Type Dictionary. - @param typeSpecifierName Name of the type on with this type is based. - @param n_cdims Number of dimensions. Cannot be 0. - @param dims dimension sizes. - */ - PointerDataType( TypeDictionary * typeDictionary, - std::string typeSpecifierName, - unsigned int n_dims, - int dims[] ) ; - /** - Constructor for ArrayDataType. - @param typeDictionary The Type Dictionary. - @param typeSpecifierName Name of the type on with this type is based. - @param dims dimension sizes. - */ - PointerDataType( TypeDictionary * typeDictionary, - std::string typeSpecifierName ) ; - - /* ==================================================================== */ - /* RULE OF THREE INTERFACE */ - /* ==================================================================== */ - - /** - Copy Constructor for PointerDataType. - */ - PointerDataType ( const PointerDataType & original ); - - /** - Destructor for PointerDataType. - */ - ~PointerDataType (); - - /** - Assignment operator for PointerDataType. - @param rhs right-hand-side. - */ - PointerDataType& operator=( const PointerDataType & rhs ); - - /* ==================================================================== */ - /* VIRTUAL INTERFACE */ - /* ==================================================================== */ - - /** - */ - bool validate(); - - /** - @return The size (in bytes) of an instance of the PointerDataType. - */ - size_t getSize() const ; - - /** - */ - TypeClass::e getTypeClass() const { - return TypeClass::POINTER; - } - - /** - */ - bool containsPointers() const; - - /** - */ - DataType * clone () const; - - /** - Create zero or more instances of this DataType. - */ - void* createInstance(unsigned int num) const ; - - /** - */ - void deleteInstance(void* address) const; - - /** - */ - void clearValue(void * address) const; - - /** - */ - void assignValue(void * address, Value * value) const; - - /** - @param s The stream to print to. - @param base_addr Address of the (entire) variable. - */ - void printValue(std::ostream &s, void * address ) const; - - /** - */ - std::string getTypeSpecName() const; - - /** - */ - std::string makeDeclaration(std::string declarator, bool isDirectDeclarator) const; - - /** - PointerDataType class specific method that returns the DataType to which this pointer is pointing. - */ - const DataType * getSubType() const; - - - private: - bool initPointerDataType( TypeDictionary * typeDictionary, std::string typeSpecName, unsigned int n_dims, int dims[]); - PointerDataType(){} - - bool is_valid; - std::string typeSpecName; - unsigned int elementCount; - DataType * ownDataType; - const DataType * subType; - TypeDictionary * typeDictionary; - -}; -#endif diff --git a/trick_source/sim_services/DataTypes/include/PointerValue.hh b/trick_source/sim_services/DataTypes/include/PointerValue.hh deleted file mode 100644 index 67695faa9..000000000 --- a/trick_source/sim_services/DataTypes/include/PointerValue.hh +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef POINTER_VALUE_H -#define POINTER_VALUE_H - -#include "Value.hh" - -/** - */ -class PointerValue : public Value { - - public: - - /** - Constructor. - @param value The value of this PointerValue. - */ - PointerValue(void * value); - - /** - Get the value of this PointerValue. - @return the value of this PointerValue. - */ - void * getPointer(); - - /** - Print this PointerValue to a stream. - */ - void print(std::ostream &s); - - /** - Get a string representation of this PointerValue. - */ - std::string toString(); - - private: - void* value; -}; -#endif diff --git a/trick_source/sim_services/DataTypes/include/PrimitiveDataType.hh b/trick_source/sim_services/DataTypes/include/PrimitiveDataType.hh deleted file mode 100644 index 8c1b8bf61..000000000 --- a/trick_source/sim_services/DataTypes/include/PrimitiveDataType.hh +++ /dev/null @@ -1,166 +0,0 @@ -#ifndef PRIMITIVE_DATA_TYPE_HH -#define PRIMITIVE_DATA_TYPE_HH - -#include "DataType.hh" -#include "IntegerValue.hh" -#include "FloatingPointValue.hh" - -#include -#include - -/** - */ -template -class PrimitiveDataType : public DataType { - -public: - - /** - Constructor for PrimitiveDataType. - */ - PrimitiveDataType() {} - ~PrimitiveDataType() {} - - /* ==================================================================== */ - /* VIRTUAL INTERFACE */ - /* ==================================================================== */ - - /** - */ - bool validate() { return true; } - - /** - @return The size (in bytes) of an instance of the DataType - */ - size_t getSize() const { - return sizeof(T); - } - - TypeClass::e getTypeClass() const { - return TypeClass::PRIMITIVE; - } - - /** - */ - DataType * clone () const { - return new PrimitiveDataType(); - } - - /** - @return an instance of the type that this PrimiitveDataType Class describes. - */ - void* createInstance(unsigned int num) const { - T* temp = (T*)calloc(num, sizeof(T)); - return ((void *)temp); - } - - /** - */ - void deleteInstance(void* address) const { - delete (T*)address; - } - - /** - */ - void clearValue(void * address) const { - - if ( isFloatingPoint() ) { - *(T*)address = 0.0; - } else { - *(T*)address = 0; - } - } - - /** - Assign a value to the variable at the given address. - @param address Address of the variable. - @param value Value to be assigned to the variable. - */ - void assignValue(void * address, Value * value) const { - - NumericValue * numeric_value_p = dynamic_cast(value); - if (numeric_value_p) { - if ( isFloatingPoint() ) { - *(T*)address = numeric_value_p->getFloatingPointValue(); - } else { - *(T*)address = numeric_value_p->getIntegerValue(); - } - } else { - std::cerr << "ERROR: Attempt to assign non-numeric value to a numeric type."; - } - } - - /** - Print the value of the variable at the given address, to the given stream. - @param s The stream to print to. - @param address Address of the variable. - */ - void printValue(std::ostream &s, void *address ) const { - s << *(T*)address ; - } - - /** - Get a string representation of this PrimitiveDataType's type-specifier. - */ - std::string getTypeSpecName() const { - std::string s(""); - return s; - } - - /** - Return true if DataType is void. Otherwise return false. - */ - bool isVoid() const { return false; } - - /* ==================================================================== */ - /* CLASS SPECIFIC INTERFACE */ - /* ==================================================================== */ - - /** - Return true if T is float or double. Otherwise return false. - */ - bool isFloatingPoint() const { return false; } - - /** - Return true if T is char, short, int, long, or long long. Otherwise return false. - */ - bool isSigned() const { return false; } - -}; - -/* - Template specializations for PrimitiveDataType::isFloatingPoint() - */ -template <> bool PrimitiveDataType::isFloatingPoint() const; -template <> bool PrimitiveDataType::isFloatingPoint() const; - -/* - Template specializations for PrimitiveDataType::isSigned() -*/ -template <> bool PrimitiveDataType::isSigned() const; -template <> bool PrimitiveDataType::isSigned() const; -template <> bool PrimitiveDataType::isSigned() const; -template <> bool PrimitiveDataType::isSigned() const; -template <> bool PrimitiveDataType::isSigned() const; - -/* - Template specializations for PrimitiveDataType::isVoid() -*/ -template <> bool PrimitiveDataType::isVoid() const; - -/* - Template specializations for PrimitiveDataType::printValue() -*/ -template <> void PrimitiveDataType::printValue(std::ostream &s, void *address ) const; -template <> void PrimitiveDataType::printValue(std::ostream &s, void *address ) const; - -/* - Template specializations for PrimitiveDataType -*/ -template <> size_t PrimitiveDataType::getSize() const; -template <> void* PrimitiveDataType::createInstance(unsigned int num) const; -template <> void PrimitiveDataType::deleteInstance(void* address) const; -template <> void PrimitiveDataType::clearValue(void * address) const; -template <> void PrimitiveDataType::assignValue(void * address, Value * value) const; -template <> void PrimitiveDataType::printValue(std::ostream &s, void *address ) const; -#endif diff --git a/trick_source/sim_services/DataTypes/include/StaticStructMember.hh b/trick_source/sim_services/DataTypes/include/StaticStructMember.hh deleted file mode 100644 index 430a6d3fb..000000000 --- a/trick_source/sim_services/DataTypes/include/StaticStructMember.hh +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef STATIC_STRUCT_MEMBER_H -#define STATIC_STRUCT_MEMBER_H - -#include "StructMember.hh" -#include "DataType.hh" -#include - -/** - */ -class StaticStructMember : public StructMember { - -public: - - /** - Constructor. - */ - StaticStructMember( std::string memberName, - void * memberAddress, - TypeDictionary* typeDictionary, - std::string typeSpecName, - unsigned int n_dims, - int dims[] ); - - /** - Copy Constructor. - */ - StaticStructMember ( const StaticStructMember & original ); - - /** - Clone. - */ - StructMember * clone () const; - - /** - Destructor. - */ - ~StaticStructMember(); - - /** - */ - bool validate(); - - /** - */ - MemberClass::e getMemberClass() const { - return MemberClass::STATIC; - } - - /** - */ - bool containsPointers() const ; - - /** - To check for circular reference only. - */ - const DataType* getDataType(); - - /** - */ - void* getAddress(); - - /** - */ - void clearValue(void *struct_address) const; - - /** - */ - void assignValue(void *struct_address, Value *v) const; - - /** - */ - void printValue(std::ostream &s, void *struct_address) const; - - /** - Product a string representation of this StaticStructMember. - */ - std::string toString() const; - -private: - //int byte_offset; - void * memberAddress; - bool is_valid; - std::string typeSpecName; - DataType * declDataType; - const DataType * subType; - TypeDictionary* typeDictionary; - -}; -#endif diff --git a/trick_source/sim_services/DataTypes/include/StringValue.hh b/trick_source/sim_services/DataTypes/include/StringValue.hh deleted file mode 100644 index 4cfe5debd..000000000 --- a/trick_source/sim_services/DataTypes/include/StringValue.hh +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef STRING_VALUE_H -#define STRING_VALUE_H - -#include "Value.hh" - -/** - */ -class StringValue : public Value { - - public: - - /** - Constructor. - @param value The value of this StringValue. - */ - StringValue(const char* value); - - /** - Print this StringValue to a stream. - */ - void print(std::ostream &s); - - /** - Get a string representation of this StringValue. - */ - std::string toString(); - - private: - std::string value; -}; - -#endif diff --git a/trick_source/sim_services/DataTypes/include/StructMember.hh b/trick_source/sim_services/DataTypes/include/StructMember.hh deleted file mode 100644 index a4a15aa0b..000000000 --- a/trick_source/sim_services/DataTypes/include/StructMember.hh +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef STRUCT_MEMBER_H -#define STRUCT_MEMBER_H - -#include -#include - -class Value; -class AllocInfo; -class TypeDictionary; -class MemMgr; - -namespace MemberClass { - enum e { - NORMAL = 0, - STATIC = 1, - BITFIELD = 2 - }; -}; - -/** - StructMember represents a data-member of a CompositeDeclaration. - */ -class StructMember { - -public: - - /** - Constructor for StructMember. - @param name The name of the member. - */ - StructMember(std::string name); - - /** - Constructor for StructMember. - @warning This should ONLY be called by a constructor of a derived class. - */ - StructMember (const StructMember & original); - - /** - Clone. - */ - virtual StructMember * clone () const = 0; - - /** - Destructor. - */ - virtual ~StructMember () { /* Nothing to do */ } - - /** - Get the name of the member. - @return std::string containing the name of the member. - */ - std::string getName() const; - - /** - */ - virtual MemberClass::e getMemberClass() const = 0; - - /** - */ - virtual bool validate() = 0; - - /** - @return does the DataType or any member of the DataType represent a pointer? - */ - virtual bool containsPointer() const { return false; } - - /** - */ - virtual void clearValue(void *struct_address) const = 0; - - /** - Assign a value to the data-member, described by this StructMember, - that is within in an instance of the composite-type described by - the parent CompositeDeclaration. - - @param struct_address Address of an instance of the composite type. - */ - virtual void assignValue(void *struct_address, Value *v) const = 0; - - /** - @param s - @param strcut_address - */ - virtual void printValue(std::ostream &s, void *struct_address) const = 0; - - /** - Get a string representation of this StructMember. - */ - virtual std::string toString() const = 0; - -private: - std::string name; - -}; -#endif diff --git a/trick_source/sim_services/DataTypes/include/TypeDictionary.hh b/trick_source/sim_services/DataTypes/include/TypeDictionary.hh deleted file mode 100644 index cca937c77..000000000 --- a/trick_source/sim_services/DataTypes/include/TypeDictionary.hh +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef TYPE_DICTIONARY_H -#define TYPE_DICTIONARY_H - -#include -#include -#include - -class DataType; - -/** - Stores name / typespecifier pairs. - */ -class TypeDictionary { - - public: - - TypeDictionary(); - - /** - Get the DataType of the for the typedef'ed name. - */ - const DataType* getDataType(std::string typeName); - - /** - Add a type definiton to the dictionary. - */ - void addTypeDefinition(std::string name, DataType * typeSpec) - ; - - /** - */ - bool validate(); - - /** - Dump the entire TypeDictionary to a std::string. - */ - std::string toString(); - - /** - Destructor. - */ - ~TypeDictionary(); - - private: - bool is_valid; - std::map typeDictionary; - std::map::iterator typeDictionaryIterator; -}; -#endif diff --git a/trick_source/sim_services/DataTypes/include/Value.hh b/trick_source/sim_services/DataTypes/include/Value.hh deleted file mode 100644 index 657ba6526..000000000 --- a/trick_source/sim_services/DataTypes/include/Value.hh +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef VALUE_H -#define VALUE_H - -#include - -/** - @brief Value is an abstract base-class that represents a value on the right-hand-side of an assignment. -*/ -class Value { - - public: - - /** - Destroy the Value. - */ - virtual ~Value() {}; - - /** - Print a representation of this Value to the given stream. - */ - virtual void print(std::ostream &s) = 0; - - /** - Get a string representation of this Value. - */ - virtual std::string toString() = 0; - -}; -#endif diff --git a/trick_source/sim_services/DataTypes/include/VarAccessInfo.hh b/trick_source/sim_services/DataTypes/include/VarAccessInfo.hh deleted file mode 100644 index 72b95b4fb..000000000 --- a/trick_source/sim_services/DataTypes/include/VarAccessInfo.hh +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef VAR_ACCESS_INFO_HH -#define VAR_ACCESS_INFO_HH - -class DataType; -class BitFieldStructMember; - -struct VarAccessInfo { - bool isBitField; - void* address; - const DataType* dataType; - const BitFieldStructMember* bitFieldStructMember; -}; -#endif diff --git a/trick_source/sim_services/DataTypes/include/Variable.hh b/trick_source/sim_services/DataTypes/include/Variable.hh deleted file mode 100644 index 6c86df41b..000000000 --- a/trick_source/sim_services/DataTypes/include/Variable.hh +++ /dev/null @@ -1,17 +0,0 @@ -//#include "declaration.hh" -// -//class Variable { -// -//public: -// size_t getsize(); -// int print_value(); -// int assign(); -// int zero(); -// int is_zero(); -// -//private: -// void *start; -// std::string name; -// TRICK_STCL stcl; -// Declaration *decl; -//} diff --git a/trick_source/sim_services/DataTypes/makefile b/trick_source/sim_services/DataTypes/makefile deleted file mode 100644 index c18d9b8e3..000000000 --- a/trick_source/sim_services/DataTypes/makefile +++ /dev/null @@ -1,62 +0,0 @@ - -RM = rm -rf -CC = gcc -CPP = c++ - - -CFLAGS = -g -Wall -INCLUDE_DIRS = -Iinclude -OBJDIR = obj -LIBDIR = lib -LIBNAME = libDecl.a -LIBOBJS = \ - ${OBJDIR}/CompositeValue.o \ - ${OBJDIR}/IntegerValue.o \ - ${OBJDIR}/FloatingPointValue.o \ - ${OBJDIR}/PointerValue.o \ - ${OBJDIR}/StringValue.o \ - ${OBJDIR}/StructMember.o \ - ${OBJDIR}/NormalStructMember.o \ - ${OBJDIR}/StaticStructMember.o \ - ${OBJDIR}/BitfieldStructMember.o \ - ${OBJDIR}/Enumerator.o \ - ${OBJDIR}/TypeDictionary.o \ - ${OBJDIR}/EnumDictionary.o \ - ${OBJDIR}/DataType.o \ - ${OBJDIR}/CompositeDataType.o \ - ${OBJDIR}/EnumDataType.o \ - ${OBJDIR}/ArrayDataType.o \ - ${OBJDIR}/PointerDataType.o \ - ${OBJDIR}/PrimitiveDataType.o \ - ${OBJDIR}/LexicalAnalyzer.o \ - ${OBJDIR}/ParsedDeclaration.o \ - ${OBJDIR}/AllocInfo.o \ - ${OBJDIR}/MemMgr.o \ - ${OBJDIR}/ClassicChkPtAgent.o - -############################################################################# -## MODEL TARGETS ## -############################################################################# - -all: ${LIBDIR}/${LIBNAME} - -$(LIBOBJS): $(OBJDIR)/%.o : src/%.cpp | $(OBJDIR) - $(CPP) $(CFLAGS) ${INCLUDE_DIRS} -c $< -o $@ - -${LIBDIR}/${LIBNAME}: ${LIBOBJS} | ${LIBDIR} - ar crs $@ ${LIBOBJS} - -${OBJDIR}: - mkdir -p ${OBJDIR} - -${LIBDIR}: - mkdir -p ${LIBDIR} - -clean: - ${RM} *~ - ${RM} ${OBJDIR} - -spotless: clean - ${RM} ${LIBDIR}/${LIBNAME} - - diff --git a/trick_source/sim_services/DataTypes/src/AllocInfo.cpp b/trick_source/sim_services/DataTypes/src/AllocInfo.cpp deleted file mode 100644 index 6e3ba14da..000000000 --- a/trick_source/sim_services/DataTypes/src/AllocInfo.cpp +++ /dev/null @@ -1,408 +0,0 @@ -#include "AllocInfo.hh" -#include "PointerDataType.hh" -#include "ArrayDataType.hh" -#include "CompositeDataType.hh" -#include "NormalStructMember.hh" -#include "StaticStructMember.hh" -#include "TypeDictionary.hh" -#include "ChkPtAgent.hh" -#include "MemMgr.hh" -#include "ParsedDeclaration.hh" -#include -#include // for memcpy - -const std::string AllocInfo::localPrefix = "trick_local_"; -const std::string AllocInfo::externPrefix = "trick_extern_"; -unsigned int AllocInfo::nextSerialNumber = 0; - -// PRIVATE MEMBER FUNCTION -void AllocInfo::initialize( const std::string& varName, - const std::string& typeSpecName, - unsigned int dimsCount, - int * dims, - TypeDictionary* typeDictionary, - void* suppliedAllocation) { - - // Because they can be resized, all allocations are really arrays, - // whether they have 0, 1, or many elements. - name = varName; - typeSpecifierName = typeSpecName; - - // If it's not specified as an array, then make it an array of 1. - if ((dimsCount == 0) || (dims[0] < 0)) { - for( int ii=0 ; ii < dimsCount ; ii++ ) { - dimensions[ii+1] = dims[ii]; - } - dimensionsCount = dimsCount + 1; - dimensions[0] = 1; - } else { - dimensionsCount = dimsCount; - for( int ii=0; ii < dimensionsCount ; ii++ ) { - dimensions[ii] = dims[ii]; - } - } - - ownDataType = new ArrayDataType( typeDictionary, typeSpecifierName, dimensionsCount, dimensions); - - if (ownDataType->validate()) { - if (ownDataType->getSize() > 0 ) { // FIXME: Is this correct? Shouldn't it be: ( ownDataType->getSubType()->getSize() > 0 ) ? - dataType = ownDataType; - } else { - std::stringstream errorStream ; - errorStream << "ERROR: Data type \"" << ownDataType->makeDeclaration( name, true) - << "\" is a useless type because it's size can only ever be 0." - << std::endl; - delete ownDataType; - throw std::logic_error( errorStream.str()); - } - } else { - std::stringstream errorStream ; - errorStream << "ERROR: Data type \"" << ownDataType->makeDeclaration( name, true) - << "\" can not be validated. Perhaps the typespecifier \"" - << typeSpecifierName << "\" is mis-spelled?" - << std::endl; - delete ownDataType; - throw std::logic_error( errorStream.str()); - } - - if ( suppliedAllocation != 0 ) { - start = suppliedAllocation; - storageClass = StorageClass::EXTERN; - } else { -// start = dataType->createInstance( dimensions[0] ); - start = dataType->createInstance(1); - storageClass = StorageClass::LOCAL; - } - - serialNumber = nextSerialNumber; - nextSerialNumber ++ ; - - end = (char*)start + dataType->getSize(); -} - -// CONSTRUCTOR -AllocInfo::AllocInfo( const std::string& varName, - const std::string& typeSpecName, - unsigned int dimsCount, - int * dims, - TypeDictionary* typeDictionary, - void* suppliedAllocation) { - - initialize(varName, typeSpecName, dimsCount, dims, typeDictionary, suppliedAllocation); -} - -// CONSTRUCTOR -AllocInfo::AllocInfo( const std::string& declaration, - TypeDictionary* typeDictionary, - void* suppliedAllocation) { - - int dims[TRICK_MAX_INDEX]; - ParsedDeclaration* parsedDeclaration = new ParsedDeclaration( declaration ); - - std::string variableName = parsedDeclaration->getVariableName(); - std::string typeSpecifier = parsedDeclaration->getTypeSpecifier(); - unsigned int dimsCount = parsedDeclaration->getNumberOfDimensions(); - for (int ii=0 ; iigetDimensionSize(ii); - } - initialize(variableName, typeSpecifier, dimsCount, dims, typeDictionary, suppliedAllocation); -} - -// DESTRUCTOR -AllocInfo::~AllocInfo() { - if (ownDataType != (DataType*)NULL) { - delete ownDataType; - } - // FIXME: what about the allocation? -} - -// PUBLIC MEMBER FUNCTION -std::string AllocInfo::getName() const { - return name; -} - -// PUBLIC MEMBER FUNCTION -std::string AllocInfo::getSerialName() const { - std::ostringstream oss; - if (storageClass == StorageClass::LOCAL) { - oss << localPrefix << serialNumber ; - } else { - oss << externPrefix << serialNumber ; - } - return oss.str(); -} - -// PUBLIC MEMBER FUNCTION -unsigned int AllocInfo::getSerialNumber() const { - return serialNumber; -} - -// PUBLIC MEMBER FUNCTION -void* AllocInfo::getStart() const { - return start; -} - -// PUBLIC MEMBER FUNCTION -int AllocInfo::getSize() const { - return dataType->getSize(); -} - -// PUBLIC MEMBER FUNCTION -std::string AllocInfo::getTypeSpecifierName() const { - return typeSpecifierName; -} - -// PUBLIC MEMBER FUNCTION -unsigned int AllocInfo::getDimensionsCount() const { - return dimensionsCount; -} - -// PUBLIC MEMBER FUNCTION -int AllocInfo::getDimensionSize(unsigned int n) const { - if ( n < dimensionsCount ) { - return dimensions[n]; - } else { - return 0; - } -} - -// PUBLIC MEMBER FUNCTION -const DataType * AllocInfo::getDataType() const { - const DataType * returnType; - if ( ownDataType->getElementCount() == 1 ) { - returnType = ownDataType->getSubType(); - } else { - returnType = ownDataType; - } - return returnType; -} - -// PUBLIC MEMBER FUNCTION -StorageClass::e AllocInfo::getStorageClass() const { - return storageClass; -} - -// PUBLIC MEMBER FUNCTION -void AllocInfo::clear() const { - dataType->clearValue(start); -} - -// PUBLIC MEMBER FUNCTION -void* AllocInfo::resize( size_t newElementCount ) { - - // We should not attempt to resize memory objects that were supplied - // to us. We should only attempt to resize objects that we created. - if ( storageClass != StorageClass::LOCAL ) { - // ERROR CONDITION - return NULL; - } - ArrayDataType* oldType = ownDataType; - void * oldMemoryObject = start; - size_t oldByteCount = oldType->getSize(); - - ArrayDataType* newType = new ArrayDataType( *oldType, newElementCount ); - void * newMemoryObject = newType->createInstance(1); - size_t newByteCount = newType->getSize(); - - size_t minByteCount; - if ( oldByteCount < newByteCount ) { - minByteCount = oldByteCount; - } else { - minByteCount = newByteCount; - } - - if (minByteCount > 0) { - memcpy( newMemoryObject, oldMemoryObject, minByteCount); - } - - delete oldType; - oldType->deleteInstance( oldMemoryObject ); - start = newMemoryObject; - end = (char*)start + newType->getSize(); - ownDataType = newType; - dataType = newType; - dimensions[0] = newElementCount; - return start; -} - -// PUBLIC MEMBER FUNCTION -bool AllocInfo::contains(void* address) const { - - if (( address >= start) && (address <= end)) { - return true; - } - return false; -} - -// PUBLIC MEMBER FUNCTION -void AllocInfo::appendDependenciesfromComposite( const CompositeDataType * compDataType, - void *address, - MemMgr* memMgr, - std::vector& dependencies) { - - int memberCount = compDataType->getMemberCount(); - - for (int ii = 0; ii < memberCount; ii++) { - - StructMember* structMember = compDataType->getStructMember(ii); - //int ioControl = structMember->getIoControl(); - int ioControl = 1; // FIXME - - if ( ioControl == 1 || ioControl == 3) { - - // Get the Member address. - char *memberAddress; - const DataType* memberDataType; - - NormalStructMember* normalStructMember = dynamic_cast(structMember); - if ( normalStructMember ) { - memberAddress = (char*)address + normalStructMember->getOffset(); - memberDataType = normalStructMember->getDataType(); - } else { - StaticStructMember* staticStructMember = dynamic_cast(structMember); - if ( staticStructMember ) { - memberAddress = (char*)staticStructMember->getAddress(); - memberDataType = staticStructMember->getDataType(); - } else { - memberAddress = NULL; // For a bitfield. - memberDataType = NULL; - } - } - if (memberAddress != NULL) { - const ArrayDataType* memberArrayDataType = dynamic_cast(memberDataType); - if ( memberArrayDataType ) { - appendDependenciesfromArray( memberArrayDataType, memberAddress, memMgr, dependencies); - } else { - const CompositeDataType* memberCompositeDataType = dynamic_cast(memberDataType); - if ( memberCompositeDataType ) { - appendDependenciesfromComposite( memberCompositeDataType, memberAddress, memMgr, dependencies); - } - } - } - } - } -} - -// PUBLIC MEMBER FUNCTION -void AllocInfo::appendDependenciesfromArray( const ArrayDataType* arrayDataType, - void* address, - MemMgr* memMgr, - std::vector& dependencies) { - - int elementCount = arrayDataType->getElementCount(); - if ( elementCount == 0 ) { - void* ptr = *(void**)address; - AllocInfo* allocInfo = memMgr->getAllocInfoOf(ptr); - allocInfo->appendDependencies( memMgr, dependencies ); - } else if ( arrayDataType->containsPointers() ){ - const DataType* elementType = arrayDataType->getSubType(); - int elementTypeSize = elementType->getSize(); - const ArrayDataType* memberArrayDataType = dynamic_cast(elementType); - if ( memberArrayDataType ) { - for (int ii=0; ii < elementCount; ii++) { - void * elementAddress = (char*) address + (ii * elementTypeSize ); - appendDependenciesfromArray( memberArrayDataType, elementAddress, memMgr, dependencies); - } - } else { - const CompositeDataType* memberCompositeDataType = dynamic_cast(elementType); - if ( memberCompositeDataType ) { - for (int ii=0; ii < elementCount; ii++) { - void * elementAddress = (char*) address + (ii * elementTypeSize ); - appendDependenciesfromComposite( memberCompositeDataType, elementAddress, memMgr, dependencies); - } - } - } - } -} - -// PUBLIC MEMBER FUNCTION -void AllocInfo::appendDependencies( MemMgr* memMgr, std::vector& dependencies ) { - - bool found = false; - int n_depends = dependencies.size(); - - // Search through the dependencies to see if "this" is in it. - for (int ii = 0 ; ii < n_depends ; ii ++) { - if (dependencies[ii] == this) { - found = true; - return; - } - } - - if (!found) { - // An allocation is dependent on itself. - dependencies.push_back(this); - const CompositeDataType* compositeDataType = dynamic_cast(dataType); - if (compositeDataType) { - // Get the dependencies in the allocation of the composite type. - appendDependenciesfromComposite( compositeDataType, start, memMgr, dependencies ); - } else { - const ArrayDataType* arrayDataType = dynamic_cast(dataType); - if ( arrayDataType ) { - appendDependenciesfromArray( arrayDataType, start, memMgr, dependencies ); - } - } - } -} - -// PUBLIC MEMBER FUNCTION -std::string AllocInfo::toString() const { - - std::ostringstream oss; - if (storageClass == StorageClass::LOCAL) { - oss << "LOCAL "; - } else { - oss << "EXTERN "; - } - oss << "<" << getDataType()->makeDeclaration( name, true) << ">"; - oss << " @"; - oss << std::hex << start << ".." ; - oss << std::hex << end << " " ; - oss << std::endl; - return oss.str(); -} - -#ifdef NEWSTUFF -// PUBLIC MEMBER FUNCTION -bool AllocInfo::getVarAccessInfo( LexicalAnalyzer* lexer, VarAccessInfo& varAccessInfo ) { - - bool errorCondition = false; - - if (dimensions[0] == 1) { - searchType = dataType->subType(); - } else { - searchType = dataType; - } - - TypeClass::e typeClass = searchType->getTypeClass(); - - nextToken = lexer->getToken(); - if (nextToken = Token::Identifier) { - std::string temp = lexer->getText(); - if (temp != name) { - errorCondition = true; - } - nextToken = lexer->getToken(); - } - - if (nextToken == Token::EndOfFile) { - varAccessInfo.dataType = dataType; - varAccessInfo.address = start; - } else if ( nextToken == Token::period) { - if (typeClass == TypeClass::COMPOSITE) { - errorCondition |= ((const CompositeDataType*)searchType)->getMemberInfo( lexer, start, varAccessInfo); - } else { - errorCondition = true; - } - } else if (nextToken == Token::LeftBracket) { - if ( typeClass == TypeClass::ARRAY ) { - errorCondition |= ((const ArrayDataType*)searchType)->getElementInfo( lexer, start, varAccessInfo); - } else { - errorCondition = true; - } - } else { - errorCondition = true; - } - return errorCondition; -} -#endif diff --git a/trick_source/sim_services/DataTypes/src/ArrayDataType.cpp b/trick_source/sim_services/DataTypes/src/ArrayDataType.cpp deleted file mode 100644 index 1ca69db78..000000000 --- a/trick_source/sim_services/DataTypes/src/ArrayDataType.cpp +++ /dev/null @@ -1,349 +0,0 @@ -#include "ArrayDataType.hh" -#include "PointerDataType.hh" -#include "TypeDictionary.hh" -#include "PointerValue.hh" -#include "CompositeValue.hh" -#include -#include - -bool ArrayDataType::initArrayDataType( TypeDictionary* typeDictionary, std::string typeSpecName, unsigned int n_dims, int dims[] ) { - - bool errorCondition = false; - // NOTE: (dim[0] >= 0) indicates an array. (dim[0] < 0) indicates a pointer. - if (( n_dims >= 1 ) && ( dims[0] >= 0 )) { - if ( n_dims == 1 ) { - this->typeSpecName = typeSpecName; - ownDataType = NULL; - this->subType = NULL; - } else if (n_dims > 1) { - this->typeSpecName.clear(); - if (dims[1] < 0) { - this->ownDataType = new PointerDataType( typeDictionary, typeSpecName, n_dims-1, &dims[1] ); - } else { - this->ownDataType = new ArrayDataType( typeDictionary, typeSpecName, n_dims-1, &dims[1] ); - } - this->subType = ownDataType; - } - elementCount = dims[0]; - this->typeDictionary = typeDictionary; - - is_valid = false; - typeSize = 0; // This is set when this ArrayDataType is validated. - } else { - // n_dims and dims don't specify an array. - errorCondition= true; - } - - return errorCondition; -} - -// CONSTRUCTOR -ArrayDataType:: ArrayDataType( TypeDictionary* typeDictionary, std::string typeSpecName, unsigned int n_dims, int dims[] ) { - - if( this->initArrayDataType( typeDictionary, typeSpecName, n_dims, dims) ) { - throw std::logic_error("ArrayDataType constructor(1) error."); - } -} - -// CONSTRUCTOR -ArrayDataType:: ArrayDataType( TypeDictionary* typeDictionary, std::string typeSpecName, unsigned int dimensionSize ) { - - int n = dimensionSize; - if( this->initArrayDataType( typeDictionary, typeSpecName, 1, &n) ) { - throw std::logic_error("ArrayDataType constructor(2) error."); - } -} - -// CONSTRUCTOR -ArrayDataType::ArrayDataType ( ArrayDataType const & original, unsigned int newSize ) { - - is_valid = original.is_valid; - typeSpecName = original.typeSpecName; - elementCount = newSize; - typeDictionary = original.typeDictionary; - - if (original.ownDataType != NULL) { - ownDataType = original.ownDataType->clone(); - } else { - ownDataType = NULL; - } - - if ( typeSpecName.empty()) { - subType = ownDataType; - } else { - if ( is_valid ) { - subType = original.subType; - } else { - subType = NULL; - } - } -} - -// COPY CONSTRUCTOR -ArrayDataType::ArrayDataType ( ArrayDataType const & original) { - - is_valid = original.is_valid; - typeSpecName = original.typeSpecName; - elementCount = original.elementCount; - typeDictionary = original.typeDictionary; - - if (original.ownDataType != NULL) { - ownDataType = original.ownDataType->clone(); - } else { - ownDataType = NULL; - } - - if ( typeSpecName.empty()) { - subType = ownDataType; - } else { - if ( is_valid ) { - subType = original.subType; - } else { - subType = NULL; - } - } -} - -DataType * ArrayDataType::clone () const { - return new ArrayDataType( *this ); -} - -// DESTRUCTOR -ArrayDataType::~ArrayDataType () { - if ( typeSpecName.empty()) { - delete subType; - } -} - -// ASSIGNMENT OPERATOR -ArrayDataType& ArrayDataType::operator=( const ArrayDataType & rhs ) { - - if ( this != &rhs ) { - - // Copy the RHS members before messing with the LHS. - DataType *clonedDataType; - if ( rhs.typeSpecName.empty() ) { - clonedDataType = rhs.subType->clone(); - } - - // Delete any pre-existing LHS members. - if ( typeSpecName.empty() ) { - delete subType; - } - - // Assign the copied RHS members to the LHS. - elementCount = rhs.elementCount; - is_valid = rhs.is_valid; - typeSpecName = rhs.typeSpecName; - - if ( typeSpecName.empty() ) { - subType = clonedDataType; - } else { - subType = rhs.subType; - } - } - return *this; -} - -// MEMBER FUNCTION -bool ArrayDataType::validate() { - - if (!is_valid) { - // if we're not referencing a dictionary type. - if (typeSpecName.empty()) { - is_valid = ownDataType->validate(); - if (is_valid) { - subType = ownDataType; - typeSize = elementCount * subType->getSize(); - } - } else { - subType = typeDictionary->getDataType( typeSpecName ); - - if (subType == NULL) { - std::cerr << "ERROR: Type \"" << typeSpecName << "\" not found." << std::endl; - } else if (subType->isVoid()) { - std::cerr << "ERROR: Cannot make an array of type void." << std::endl; - } else { - is_valid = true; - typeSize = elementCount * subType->getSize(); - } - } - } - return is_valid; -} - -// MEMBER FUNCTION -size_t ArrayDataType::getSize() const { - - if (is_valid) { - return typeSize; - } else { - std::cerr << "ERROR: Can't getSize() because type hasn't been validated." << std::endl; - return 0; - } -} - -// MEMBER FUNCTION -unsigned int ArrayDataType::getTotalElementCount() const { - unsigned int totalElementCount = elementCount * ownDataType->getTotalElementCount(); - return totalElementCount; -} - -// MEMBER FUNCTION -bool ArrayDataType::containsPointers() const { - - if ((subType->containsPointers())) { - return true; - } - return false; -} - -// MEMBER FUNCTION -void* ArrayDataType::createInstance(unsigned int num) const { - - if (subType != NULL) { - return subType->createInstance( num * elementCount ); - } else { - std::cerr << "ERROR: Can't create an instance of an unvalidated type." << std::endl; - return (void*) NULL; - } -} - -// MEMBER FUNCTION -void ArrayDataType::deleteInstance(void* address) const { - if (subType != NULL) { - return subType->deleteInstance(address); - } else { - std::cout << "WARNING: Can't delete an instance of an unvalidated type." << std::endl; - } -} - -// MEMBER FUNCTION -void ArrayDataType::clearValue(void * address) const { - if (is_valid) { - for (int ii=0; ii < elementCount ; ii++) { - void * elementAddress = (char*)address + (ii * subType->getSize()); - subType->clearValue( elementAddress ); - } - } else { - std::cerr << "ERROR: Type is not yet validated."; - } -} - -// MEMBER FUNCTION -void ArrayDataType::assignValue(void * address, Value*value) const { - - if (is_valid) { - CompositeValue * composite_value_p = dynamic_cast(value); - if (composite_value_p) { - for (int ii=0; ii < elementCount ; ii++) { - void * elementAddress = (char*)address + (ii * subType->getSize()); - subType->assignValue( elementAddress, (*composite_value_p)[ii] ); - } - } else { - std::cerr << "ERROR: Value assigned to an array must be a composite value."; - } - } else { - std::cerr << "ERROR: Type is not valid for assignment."; - } -} - -// MEMBER FUNCTION -void ArrayDataType::printValue(std::ostream &s, void * address) const { - - if (is_valid) { - s << "{"; - for (int ii=0; ii < elementCount ; ii++) { - if (ii) { - s << ","; - } - void * elementAddress = (char*) address + (ii * subType->getSize()); - subType->printValue( s, elementAddress ); - } - s << "}"; - } else { - std::cerr << "ERROR: Type is not valid."; - } -} - -// MEMBER FUNCTION -std::string ArrayDataType::getTypeSpecName() const { - if ( !typeSpecName.empty()) { - return typeSpecName; - } else { - return subType->getTypeSpecName(); - } -} - -// MEMBER FUNCTION -std::string ArrayDataType::makeDeclaration(std::string declarator, bool isDirectDeclarator) const { - std::string outTypeName; - std::stringstream ss; - - if ( isDirectDeclarator ) { - ss << declarator << "[" << getElementCount() << "]" ; - } else { - ss << "(" << declarator << ")" << "[" << getElementCount() << "]" ; - } - if (subType != NULL) { - outTypeName = subType->makeDeclaration( ss.str(), true ); - } else { - outTypeName = getTypeSpecName() + ss.str(); - } - return outTypeName; -} - -// MEMBER FUNCTION -unsigned int ArrayDataType::getElementCount() const { - return elementCount; -} - -// MEMBER FUNCTION -const DataType * ArrayDataType::getSubType() const { - return subType; -} - -#ifdef NEWSTUFF -// MEMBER FUNCTION -bool ArrayDataType::getElementInfo( LexicalAnalyzer* lexer, void* baseAddress, VarAccessInfo& varAccessInfo ) { - - bool errorCondition = false; - nextToken = lexer->getToken(); - if (nextToken = Token::Integer) { - int index = std::atoi( (lexer->getText()).c_str() ); - } - if ( (index >= 0) && (index < elementCount)) { - const DataType* elementDataType = subType->getDataType(); - TypeClass::e elementDataTypeClass = subType->getTypeClass(); - void* elementAddress = (char*) baseAddress + (index * subType->getSize()); - nextToken = lexer->getToken(); - if (nextToken == Token::RightBracket) { - - nextToken = lexer->getToken(); - if (nextToken == Token::EndOfFile) { - varAccessInfo.dataType = elementDataType; - varAccessInfo.address = elementAddress; - } else if ( nextToken == Token::period) { - if (elementDataTypeClass == TypeClass::COMPOSITE) { - errorCondition |= ((const CompositeDataType*)searchType)->getMemberInfo( lexer, elementAddress, varAccessInfo); - } else { - errorCondition = true; - } - } else if (nextToken == Token::LeftBracket) { - if ( typeClass == TypeClass::ARRAY ) { - errorCondition |= ((const ArrayDataType*)searchType)->getElementInfo( lexer, elementAddress, varAccessInfo); - } else { - errorCondition = true; - } - } else { - errorCondition = true; - } - } else { - errorCondition = true; - } - } else { - errorCondition = true; - } - return errorCondition; -} -#endif diff --git a/trick_source/sim_services/DataTypes/src/BitfieldStructMember.cpp b/trick_source/sim_services/DataTypes/src/BitfieldStructMember.cpp deleted file mode 100644 index 5ad52dc32..000000000 --- a/trick_source/sim_services/DataTypes/src/BitfieldStructMember.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "BitfieldStructMember.hh" - -/* - Template specializations for BitfieldStructMember::getTypeSpecName() - */ -template <> std::string BitfieldStructMember::getTypeSpecName() const { - std::string s("char"); return s; -} -template <> std::string BitfieldStructMember::getTypeSpecName() const { - std::string s("short"); return s; -} -template <> std::string BitfieldStructMember::getTypeSpecName() const { - std::string s("int"); return s; -} -template <> std::string BitfieldStructMember::getTypeSpecName() const { - std::string s("long"); return s; -} -template <> std::string BitfieldStructMember::getTypeSpecName() const { - std::string s("long long"); return s; -} -template <> std::string BitfieldStructMember::getTypeSpecName() const { - std::string s("unsigned char"); return s; -} -template <> std::string BitfieldStructMember::getTypeSpecName() const { - std::string s("unsigned short"); return s; -} -template <> std::string BitfieldStructMember::getTypeSpecName() const { - std::string s("unsigned int"); return s; -} -template <> std::string BitfieldStructMember::getTypeSpecName() const { - std::string s("unsigned long"); return s; -} -template <> std::string BitfieldStructMember::getTypeSpecName() const { - std::string s("unsigned long long"); return s; -} - diff --git a/trick_source/sim_services/DataTypes/src/ClassicChkPtAgent.cpp b/trick_source/sim_services/DataTypes/src/ClassicChkPtAgent.cpp deleted file mode 100644 index 8e361a7dd..000000000 --- a/trick_source/sim_services/DataTypes/src/ClassicChkPtAgent.cpp +++ /dev/null @@ -1,397 +0,0 @@ -#include "ClassicChkPtAgent.hh" - -#include "DataType.hh" - -#include "AllocInfo.hh" - -#include "PrimitiveDataType.hh" -#include "ArrayDataType.hh" -#include "PointerDataType.hh" -#include "CompositeDataType.hh" -#include "EnumDataType.hh" - -#include "StructMember.hh" -#include "NormalStructMember.hh" -#include "StaticStructMember.hh" -#include "BitfieldStructMember.hh" - -#include "MemMgr.hh" - -// STATIC FUNCTION -static void writeStringLiteral( std::ostream& os, const char* s) { - int ii; - int len = strlen(s); - os << "\"" ; - for (ii=0 ; ii 0) { - leftSideNameStack.pop_back(); - } else { - errorStream << "WARNING: ClassicChkPtAgent::popNameElement called with an empty name stack." << std::endl; - } -} - -// MEMBER FUNCTION -std::string ClassicChkPtAgent::getLeftSideName() { - - std::stringstream nameStream; - int numElements = leftSideNameStack.size(); - for (int ii = 0; ii < numElements; ii ++ ) { - std::string element = leftSideNameStack[ii]; - nameStream << element; - } - return nameStream.str(); -} - -// MEMBER FUNCTION -bool ClassicChkPtAgent:: writeDeclaration( std::ostream& out_s, std::string name, const DataType * dataType) { - bool errorCondition = false; - if (dataType != NULL) { - out_s << dataType->makeDeclaration(name, true); - out_s << ";\n"; - } else { - errorCondition = true; - } - return errorCondition; -} - -// MEMBER FUNCTION -bool ClassicChkPtAgent::writeVariable( std::ostream& out_s, MemMgr* memMgr, void* address, const DataType* dataType ) { - - bool errorCondition = false; - TypeClass::e typeClass = dataType->getTypeClass(); - if ( ( typeClass == TypeClass::PRIMITIVE ) || ( typeClass == TypeClass::ENUMERATION ) ) { - std::stringstream rightHandSide; - dataType->printValue( rightHandSide, address ); - writeAssignment( out_s, rightHandSide.str() ); - out_s << "\n"; - } else if ( typeClass == TypeClass::POINTER ) { - std::stringstream pointerName; - errorCondition |= writePointerValue( pointerName, memMgr, address, (const PointerDataType*) dataType); - writeAssignment(out_s, pointerName.str()); - out_s << "\n"; - } else if ( typeClass == TypeClass::COMPOSITE ) { - errorCondition |= writeCompositeAssignments( out_s, memMgr, address, (const CompositeDataType*)dataType); - } else if ( typeClass == TypeClass::ARRAY ) { - errorCondition |= writeArrayAssignments( out_s, memMgr, address, (const ArrayDataType*)dataType); - } else { - errorCondition = true; - errorStream << "ERROR: Unknown TypeClass in ClassicChkPtAgent::writeVariable." << std::endl; - } - return errorCondition; -} - -// MEMBER FUNCTION -bool ClassicChkPtAgent::writePointerValue( std::ostream& out_s, MemMgr* memMgr, void* address, const PointerDataType* pointerDataType ) { - - bool errorCondition = false; - void* pointerValue = *(void**)address; - const DataType* subType = pointerDataType->getSubType(); // FIXME: this can return NULL - const AllocInfo* allocInfo = memMgr->getAllocInfoOf( pointerValue ); - - if (allocInfo != NULL) { - out_s << "&" << allocInfo->getName(); - errorCondition |= getSubName( out_s, pointerValue, subType, allocInfo->getStart(), allocInfo->getDataType() ); - } else if ( subType == memMgr->getDataType( "char" )) { - writeStringLiteral( out_s, (char*)pointerValue ); - } else { - errorCondition = true; - errorStream << "ERROR: The variable \"" << getLeftSideName() << "\" contains "; - errorStream << "a pointer to memory that isnt managed by Trick "; - errorStream << "and it isn't a char pointer." << std::endl; - } - return errorCondition; -} - -// MEMBER FUNCTION -bool ClassicChkPtAgent:: writeArrayAssignments( std::ostream& out_s, MemMgr* memMgr, void* address, const ArrayDataType* arrayDataType ) { - - bool errorCondition = false; - int elementCount = arrayDataType->getElementCount(); - const DataType * elementType = arrayDataType->getSubType(); // FIXME: this can return NULL - size_t elementTypeSize = elementType->getSize(); - - TypeClass::e elementTypeClass = elementType->getTypeClass(); - - if ( makeCompactArrays && - (( elementTypeClass == TypeClass::PRIMITIVE) || - ( elementTypeClass == TypeClass::ENUMERATION) || - ( elementTypeClass == TypeClass::POINTER))) { - - std::stringstream rightHandSide; - rightHandSide << "{" ; - for (int ii=0; ii < elementCount; ii++) { - void * elementAddress = (char*) address + (ii * elementTypeSize ); - if (ii != 0) { - rightHandSide << ","; - } - if ( elementTypeClass == TypeClass::POINTER ) { - errorCondition |= writePointerValue( rightHandSide, memMgr, elementAddress, (const PointerDataType*) elementType); - } else { - elementType->printValue( rightHandSide, elementAddress ); - } - } - rightHandSide << "}"; - writeAssignment( out_s, rightHandSide.str() ); - out_s << "\n"; - } else { - for (int ii=0; ii < elementCount; ii++) { - void * elementAddress = (char*) address + (ii * elementTypeSize ); - pushIndex(ii); - errorCondition |= writeVariable( out_s, memMgr, elementAddress, elementType ); - popNameElement(); - } - } - return errorCondition; -} - -// MEMBER FUNCTION -bool ClassicChkPtAgent::writeCompositeAssignments( std::ostream& out_s, MemMgr* memMgr, void* address, const CompositeDataType* compDataType) { - - bool errorCondition = false; - - int memberCount = compDataType->getMemberCount(); - - for (int ii = 0; ii < memberCount; ii++) { - - //int ioControl = structMember->getIoControl(); - int ioControl = 1; // FIXME: implement Trick's IOControl. - - if ( ioControl == 1 || ioControl == 3) { - - StructMember* structMember = compDataType->getStructMember(ii); - MemberClass::e memberClass = structMember->getMemberClass(); - - if ( memberClass == MemberClass::BITFIELD ) { - std::stringstream rightHandSide; - structMember->printValue( rightHandSide, address ); - writeAssignment( out_s, rightHandSide.str() ); - out_s << "\n"; - } else { - char* memberAddress; - const DataType* memberDataType; - if ( memberClass == MemberClass::NORMAL ) { - NormalStructMember* normalStructMember = (NormalStructMember*)structMember; - memberAddress = (char*)address + normalStructMember->getOffset(); - memberDataType = normalStructMember->getDataType(); - } else if ( memberClass == MemberClass::STATIC ) { - StaticStructMember* staticStructMember = (StaticStructMember*)structMember; - memberAddress = (char*)staticStructMember->getAddress(); - memberDataType = staticStructMember->getDataType(); - } else { - errorCondition = true; - errorStream << "ERROR: " << std::endl; - return errorCondition; - } - std::string memberName = structMember->getName(); - - pushName(memberName.c_str()); - errorCondition |= writeVariable( out_s, memMgr, memberAddress, memberDataType); - popNameElement(); - } - } - } - return errorCondition; -} - -// MEMBER FUNCTION -void ClassicChkPtAgent:: writeAssignment( std::ostream& out_s, std::string rightHandSide ) { - out_s << getLeftSideName() << " = " << rightHandSide << ";" ; -} - -// MEMBER FUNCTION -bool ClassicChkPtAgent:: getArraySubName( std::ostream& nameStream, - void * searchAddress, - const DataType * searchType, - void * baseAddress, - const ArrayDataType * baseType ) { - bool errorCondition = false; - size_t baseTypeSize = baseType->getSize(); - - if (( searchAddress >= (char *)baseAddress ) && - ( searchAddress < (char *)baseAddress + baseTypeSize)) { - - const DataType * elementType = baseType->getSubType(); // FIXME: this can return NULL - size_t elementTypeSize = elementType->getSize(); - long elementIndex = ((long)searchAddress - (long)baseAddress) / elementTypeSize; - void * elementAddress = (char*) baseAddress + ( elementIndex * elementTypeSize ); - - nameStream << "[" << elementIndex << "]"; - - errorCondition = getSubName( nameStream, searchAddress, searchType, elementAddress, elementType); - - } else { - errorCondition = true; - errorStream << "ERROR: Bad call to ClassicChkPtAgent::getArraySubName(). " - << "The searchAddress (" << searchAddress << ") " - << "is not within the bounds of the base-object " - << "(" << baseAddress << ".." - << (void*)((char *)baseAddress + baseTypeSize) << ")" << std::endl; - } - - return errorCondition; -} - -// MEMBER FUNCTION -bool ClassicChkPtAgent::getCompositeSubName( std::ostream& nameStream, - void * searchAddress, - const DataType * searchType, - void * baseAddress, - const CompositeDataType * baseType ) { - bool errorCondition = false; - size_t baseTypeSize = baseType->getSize(); - - if (( searchAddress >= (char *)baseAddress ) && - ( searchAddress < (char *)baseAddress + baseTypeSize)) { - - int memberCount = baseType->getMemberCount(); - int memberIndex = 0; - bool memberFound = false; - - while ((memberIndex < memberCount) && (memberFound == false)) { - - StructMember* structMember = baseType->getStructMember(memberIndex); - MemberClass::e memberClass = structMember->getMemberClass(); - - /* - We don't consider BITFIELD members because pointers to bitfields are meaningless. - Also note that we don't consider STATIC class members. This is because static - members aren't really class object members, rather they are global variables. - */ - - // FIXME: Static class variables are dealt with else where. - - if ( memberClass == MemberClass::NORMAL ) { - - NormalStructMember* normalStructMember = (NormalStructMember *)structMember; - - const DataType * memberDataType = normalStructMember->getDataType(); // FIXME: this can return NULL - size_t memberTypeSize = memberDataType->getSize(); - int memberOffset = normalStructMember->getOffset(); - char * memberAddress = (char*)baseAddress + memberOffset; - - if ( ( searchAddress >= (char *)memberAddress ) && - ( searchAddress < (char *)memberAddress + memberTypeSize )) { - - memberFound = true; - nameStream << "." << structMember->getName(); - errorCondition = getSubName( nameStream, searchAddress, searchType, memberAddress, memberDataType); - - } - } - memberIndex ++; - } - - if (!memberFound) { - errorCondition = true; - errorStream << "ERROR: Bad call to ClassicChkPtAgent::getCompositeSubName(). " - << "The searchAddress (" << searchAddress << ") " - << "is not within the bounds of the base-object " - << "(" << baseAddress << ".." - << (void*)((char *)baseAddress + baseTypeSize) << ")" << std::endl; - } - - } else { - errorCondition = true; - errorStream << "ERROR: Bad call to ClassicChkPtAgent::getCompositeSubName(). The address in " - << "the parameter is not within the bounds of the object " - << "at ." << std::endl; - } - return errorCondition; -} - -// MEMBER FUNCTION -bool ClassicChkPtAgent:: getSubName( std::ostream& nameStream, - void * searchAddress, - const DataType * searchType, - void * baseAddress, - const DataType * baseType ) { - bool errorCondition = false; - size_t baseTypeSize = baseType->getSize(); - - if ( ( searchAddress >= (char *)baseAddress ) && - ( searchAddress < (char *)baseAddress + baseTypeSize)) { - - if ( searchType == baseType ) { - if ( searchAddress != baseAddress ) { - errorCondition = true; - errorStream << "ERROR: Something is messed up. Misaligned pointer." << std::endl; - nameStream << " + " << ((long)searchAddress - (long)baseAddress); - } - } else { - TypeClass::e typeClass = baseType->getTypeClass(); - - if ( typeClass == TypeClass::COMPOSITE ) { - errorCondition = getCompositeSubName( nameStream, searchAddress, searchType, baseAddress, (const CompositeDataType *)baseType ); - } else if ( typeClass == TypeClass::ARRAY ) { - errorCondition = getArraySubName( nameStream, searchAddress, searchType, baseAddress, (const ArrayDataType *)baseType ); - } else { - errorCondition = true; - errorStream << "ERROR: The data-type of \"" << getLeftSideName() << " doesnt match what it's pointing to." << std::endl; - } - } - } else { - errorCondition = true; - errorStream << "ERROR: Bad call to ClassicChkPtAgent::getSubName(). " - << "The searchAddress (" << searchAddress << ") " - << "is not within the bounds of the base-object " - << "(" << baseAddress << ".." - << (void*)((char *)baseAddress + baseTypeSize) << ")" << std::endl; - } - return errorCondition; -} - -// MEMBER FUNCTION -int ClassicChkPtAgent:: restore( std::istream* checkpoint_stream) { return(0); } - -// MEMBER FUNCTION -void ClassicChkPtAgent:: setReducedCheckpoint(bool flag) { - reducedCheckpoint = flag; -} - -// MEMBER FUNCTION -void ClassicChkPtAgent:: setHexfloatCheckpoint(bool flag) { - hexfloatCheckpoint = flag; -} - -// MEMBER FUNCTION -void ClassicChkPtAgent:: setMakeCompactArrays(bool flag) { - makeCompactArrays = flag; -} - -// MEMBER FUNCTION -void ClassicChkPtAgent:: setDebugLevel(int level) { } diff --git a/trick_source/sim_services/DataTypes/src/CompositeDataType.cpp b/trick_source/sim_services/DataTypes/src/CompositeDataType.cpp deleted file mode 100644 index 242456ed4..000000000 --- a/trick_source/sim_services/DataTypes/src/CompositeDataType.cpp +++ /dev/null @@ -1,349 +0,0 @@ -#include "TypeDictionary.hh" -#include "CompositeDataType.hh" -#include "CompositeValue.hh" -#include "NormalStructMember.hh" -#include "StaticStructMember.hh" -#include "BitfieldStructMember.hh" -#include "LexicalAnalyzer.hh" -#include - -CompositeDataType::CompositeDataType() { - - this->is_valid = false; - this->structSize = 0; -} - -// CONSTRUCTOR -CompositeDataType::CompositeDataType( TypeDictionary* typeDictionary, - std::string name, - size_t structSize, - void* (*allocator)(int), - void (*deAllocator)(void*) ) { - this->is_valid = false; - this->name = name; - this->structSize = structSize; - this->allocator = allocator; - this->deAllocator = deAllocator; - this->typeDictionary = typeDictionary; -} - -// CONSTRUCTOR -CompositeDataType::CompositeDataType ( const CompositeDataType & original ) { - - this->structSize = original.structSize; - this->is_valid = original.is_valid; - - int memberCount = original.memberList.size() ; - for (int ii=0; ii < memberCount ; ii++) { - StructMember* cloned_member = original.memberList[ii]->clone(); - this->memberList.push_back( cloned_member ); - } -} - -DataType * CompositeDataType::clone() const { - return new CompositeDataType( *this ); -} - -// DESTRUCTOR -CompositeDataType::~CompositeDataType() { - int memberCount = memberList.size() ; - for (int ii=0; ii < memberCount ; ii++) { - delete memberList[ii]; - } -} - -bool CompositeDataType::validate() { - - // FIXME: Check for circular dependencies. - // Also need a to check that this->subType (ptr) is not equal - // to any of the member->subType's. Otherwise we will have a circular reference. - - if (!is_valid) { - - is_valid = true; - - int memberCount = memberList.size() ; - for (int ii=0 ; ii < memberCount ; ii++) { - is_valid = is_valid && memberList[ii]->validate(); - } - - /* FIXME: Also need to verify that the structSize is at least as great as the max - member offset plus the size of that member. This may require StructMember to have - virtual members for getSize and getOffset. Note that this has to work with bitfields. */ - - } - return is_valid; -} - -// MEMBER FUNCTION -size_t CompositeDataType::getSize() const { - return structSize; -} - -// OPERATOR= -CompositeDataType & CompositeDataType::operator=(const CompositeDataType & rhs) { -// FIXME: -// int memberCount; -// if (this != &rhs) { -// std::vector new_member_list; -// -// // Copy the RHS members before messing with the LHS. -// try { -// memberCount = rhs.memberList.size() ; -// for (int ii=0; ii < memberCount ; ii++) { -// StructMember* cloned_member = rhs.memberList[ii]->clone(); -// new_member_list.push_back( cloned_member ); -// } -// } catch (std::logic_error) { -// memberCount = new_member_list.size() ; -// for (int ii=0; ii < memberCount ; ii++) { -// delete new_member_list[ii]; -// } -// throw; -// } -// -// // Delete any pre-existing LHS members. -// memberCount = memberList.size() ; -// for (int ii=0; ii < memberCount ; ii++) { -// delete this->memberList[ii]; -// } -// -// // Assign the copied RHS members to the LHS. -// memberCount = new_member_list.size() ; -// for (int ii=0; ii < memberCount ; ii++) { -// memberList.push_back( new_member_list[ii] ); -// } -// } - return *this; -} - -// MEMBER FUNCTION -bool CompositeDataType::containsPointer() const { - - int memberCount = memberList.size() ; - for (int ii=0; ii < memberCount ; ii++) { - if ( memberList[ii]->containsPointer() ) { - return true; - } - } - return false; -} - -// MEMBER FUNCTION -void* CompositeDataType::createInstance(unsigned int num) const { - - void* address; - if (allocator == NULL) { - // Allocate using calloc. - if ((address = calloc( (size_t)num, (size_t)structSize )) == NULL) { - std::cerr << "ERROR: Out of memory." << std::endl; - return ((void*)NULL); - } - } else { - // Allocate using the allocator. - if ((address = allocator( num)) == NULL) { - std::cerr << "ERROR: Out of memory." << std::endl; - return ((void*)NULL); - } - } - return address; -} - -// MEMBER FUNCTION -void CompositeDataType::deleteInstance(void* address) const { - - if (allocator != NULL) { - if(deAllocator != NULL) { - deAllocator(address); - } else { - // FIXME: WARNING. - } - } else { - free(address); - } -} - -// MEMBER FUNCTION -void CompositeDataType::clearValue(void * address) const { - - int memberCount = memberList.size() ; - for (int ii=0; ii < memberCount ; ii++) { - memberList[ii]->clearValue( address); - } -} - -// MEMBER FUNCTION -void CompositeDataType::assignValue(void * address, Value * value) const { - - // Confirm that the value is a CompositeValue. - CompositeValue * composite_value = dynamic_cast(value); - - if (composite_value) { - - int memberCount = memberList.size() ; - - int num_values = composite_value->getMemberCount(); - if ( memberCount != num_values) { - std::cerr << "ERROR: number of members (" << memberCount - << ") and number of values (" << num_values - << ") is not the same."; - } - - for (int ii=0; ii < memberCount ; ii++) { - memberList[ii]->assignValue( address, (*composite_value)[ii]); - } - - } else { - std::cerr << "ERROR: Cannot assign a non-composite value to a composite type."; - } -} - -// MEMBER FUNCTION -void CompositeDataType::printValue(std::ostream &s, void *address) const { - - int memberCount = memberList.size() ; - s << "{"; - for (int ii=0; ii < memberCount ; ii++) { - if (ii) { - s << ", "; - } - memberList[ii]->printValue(s, address); - } - s << "}"; -} - -// MEMBER FUNCTION -std::string CompositeDataType::toString() const { - std::stringstream ss; - int memberCount = memberList.size() ; - ss << "composite {\n"; - for (int ii=0; ii < memberCount ; ii++) { - ss << memberList[ii]->toString(); - ss << ";\n"; - } - ss << "}\n"; - return ss.str(); -} - -// MEMBER FUNCTION -std::string CompositeDataType::getTypeSpecName() const { - return name; -} - -// MEMBER FUNCTION -void CompositeDataType::addRegularMember( std::string memberName, - int member_offset, - std::string typeSpecName, - unsigned int n_dims, - int dims[] ) { - - int memberCount = memberList.size() ; - for (int ii=0 ; ii < memberCount ; ii++) { - if (memberName == memberList[ii]->getName()) { - std::stringstream error_stream ; - error_stream << "ERROR: Attempt to re-define member \"" << memberName << "\"." << std::endl; - throw std::logic_error( error_stream.str()); - } - } - - memberList.push_back( - new NormalStructMember(memberName, member_offset, typeDictionary, typeSpecName, n_dims, dims) - ); -} - -// MEMBER FUNCTION -void CompositeDataType::addStaticMember( std::string memberName, - void * memberAddress, - std::string typeSpecName, - unsigned int n_dims, - int dims[] ) { - - int memberCount = memberList.size() ; - for (int ii=0 ; ii < memberCount ; ii++) { - if (memberName == memberList[ii]->getName()) { - std::stringstream error_stream ; - error_stream << "ERROR: Attempt to re-define member \"" << memberName << "\"." << std::endl; - throw std::logic_error( error_stream.str()); - } - } - - memberList.push_back( - new StaticStructMember( memberName, memberAddress, typeDictionary, typeSpecName, n_dims, dims ) - ); - -} - - -// MEMBER FUNCTION -int CompositeDataType::getMemberCount() const { - return ( (int)memberList.size() ); -} - -// MEMBER FUNCTION -StructMember* CompositeDataType::getStructMember (const int index) const { - return ( memberList[index] ); -} - -#ifdef NEWSTUFF -// MEMBER FUNCTION -bool CompositeDataType::getMemberInfo( LexicalAnalyzer* lexer, void* baseAddress, VarAccessInfo& varAccessInfo ) { - - bool errorCondition = false; - - Token::e nextToken = lexer->getToken(); - - if (nextToken == Token::Identifier) { - std::string memberName = lexer->getText(); - int memberCount = memberList.size() ; - int ii = 0; - while ( (ii < memberCount) && - (memberName != memberList[ii]->getName())) { - ii ++; - } - if (ii < memberCount) { - StructMember* member = memberList[ii]; - MemberClass::e memberClass = member->getMemberClass(); - const DataType* memberDataType = member->getDataType(); - TypeClass::e memberDataTypeClass = memberDataType->getTypeClass(); - - void* memberAddress = NULL; - if ( memberClass == MemberClass::BITFIELD ) { - memberAddress = baseAddress; - } else if ( memberClass == MemberClass::STATIC ) { - memberAddress = ((StaticStructMember*)member)->getAddress(); - } else if ( memberClass == MemberClass::NORMAL ) { - memberAddress = baseAddress + ((NormalStructMember*)member)->getOffset() ; - } else { - errorCondition = true; - } - - if (!errorCondition) { - nextToken = lexer->getToken(); - if (nextToken == Token::EndOfFile) { - varAccessInfo.dataType = memberDataType; - varAccessInfo.address = memberAddress; - } else if (nextToken == Token::period) { - if (memberDataTypeClass == TypeClass::COMPOSITE) { - errorCondition |= ((const CompositeDataType*)memberDataType)->getMemberInfo( lexer, memberAddress, varAccessInfo); - } else { - errorCondition = true; - } - } else if (nextToken == Token::LeftBracket) { - if ( typeClass == TypeClass::ARRAY ) { - errorCondition |= ((const ArrayDataType*)searchType)->getElementInfo( lexer, memberAddress, varAccessInfo); - } else { - errorCondition = true; - } - } else { - errorCondition = true; - } - } - } else { - errorCondition = true; - } - } else { - errorCondition = true; - } - return errorCondition; -} -#endif diff --git a/trick_source/sim_services/DataTypes/src/CompositeValue.cpp b/trick_source/sim_services/DataTypes/src/CompositeValue.cpp deleted file mode 100644 index 33892c8f9..000000000 --- a/trick_source/sim_services/DataTypes/src/CompositeValue.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "CompositeValue.hh" -#include - -// DESTRUCTOR -CompositeValue::~CompositeValue() { - int n = member_list.size(); - for (int ii= 0 ; ii < n; ii++) { - delete( member_list[ii] ); - } -} - -// MEMBER FUNCTION -void CompositeValue::addMember(Value* value) { - member_list.push_back(value); -} - -// MEMBER FUNCTION -int CompositeValue::getMemberCount() { - return ( (int)member_list.size() ); -} - -// MEMBER FUNCTION -Value*& CompositeValue::operator[] (const int index) { - return ( member_list[index] ); -} - -// MEMBER FUNCTION -void CompositeValue::print(std::ostream &s) { - int n = member_list.size(); - s << "{"; - for (int ii= 0 ; ii < n; ii++) { - if (ii != 0) { - s << ","; - } - member_list[ii]->print(s); - } - s << "}"; -} - -// MEMBER FUNCTION -std::string CompositeValue::toString() { - std::ostringstream oss; - - int n = member_list.size(); - oss << "{"; - for (int ii= 0 ; ii < n; ii++) { - if (ii != 0) { - oss << ","; - } - oss << member_list[ii]->toString(); - } - oss << "}"; - return oss.str(); -} - diff --git a/trick_source/sim_services/DataTypes/src/DataType.cpp b/trick_source/sim_services/DataTypes/src/DataType.cpp deleted file mode 100644 index dab0e3e8b..000000000 --- a/trick_source/sim_services/DataTypes/src/DataType.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "DataType.hh" -#include - -/* - type-name: type-specifier - | type-specifier declarator - ; - - declarator : pointer - | pointer direct-declarator - | direct-declarator - ; - - direct-declarator: identifier - | ( declarator ) - | [ constant-exp ] - | [ ] - | direct-declarator [ constant-exp ] - | direct-declarator [ ] - ; -*/ - -// VIRTUAL MEMBER FUNCTION -// NOTE: PointerDataType and ArrayDataType overrides this member-function. -std::string DataType::makeDeclaration(std::string declarator, bool isDirectDeclarator) const { - std::stringstream ss; - if (declarator.empty()) { - ss << getTypeSpecName(); - } else { - ss << getTypeSpecName() << " " << declarator ; - } - return ss.str(); -} - -// VIRTUAL MEMBER FUNCTION -std::string DataType::toString() const { - return makeDeclaration("", true); -} diff --git a/trick_source/sim_services/DataTypes/src/EnumDataType.cpp b/trick_source/sim_services/DataTypes/src/EnumDataType.cpp deleted file mode 100644 index c63dcadf4..000000000 --- a/trick_source/sim_services/DataTypes/src/EnumDataType.cpp +++ /dev/null @@ -1,193 +0,0 @@ -#include "EnumDataType.hh" -#include "EnumDictionary.hh" -#include "NumericValue.hh" -#include "IntegerValue.hh" -#include -#include - -EnumDataType::EnumDataType( EnumDictionary * enumDictionary, - std::string name, - size_t enumSize) { - - if ((enumSize == sizeof(int)) || (enumSize == sizeof(short)) || (enumSize == sizeof(char))) { - this->enumSize = enumSize; - } // FIXME: else throw? - - this->enumDictionary = enumDictionary; - this->name = name; -} - -/* ==================================================================== */ -/* RULE OF THREE INTERFACE */ -/* ==================================================================== */ - -EnumDataType::EnumDataType ( const EnumDataType & original ) { - this->enumSize = original.enumSize; - - int enum_count = original.enum_list.size() ; - for (int ii=0; ii < enum_count ; ii++) { - Enumerator* dupl_enum = new Enumerator( *original.enum_list[ii]); - this->enum_list.push_back( dupl_enum ); - } -} - -EnumDataType::~EnumDataType () { - - int enum_count = enum_list.size() ; - for (int ii=0; ii < enum_count ; ii++) { - delete enum_list[ii]; - } -} - -EnumDataType & EnumDataType::operator=( const EnumDataType & rhs ) { - if (this != &rhs) { - - std::vector new_enum_list; - int enum_count; - - // Copy the RHS members before messing with the LHS. - try { - enum_count = rhs.enum_list.size() ; - for (int ii=0; ii < enum_count ; ii++) { - Enumerator* dupl_enum = new Enumerator( *rhs.enum_list[ii]); - new_enum_list.push_back( dupl_enum ); - } - } catch (std::logic_error) { - enum_count = new_enum_list.size() ; - for (int ii=0; ii < enum_count ; ii++) { - delete new_enum_list[ii]; - } - throw; - } - - // Delete any pre-existing LHS members. - enum_count = enum_list.size() ; - for (int ii=0; ii < enum_count ; ii++) { - delete this->enum_list[ii]; - } - - // Assign the copied RHS members to the LHS. - enum_count = new_enum_list.size() ; - for (int ii=0; ii < enum_count ; ii++) { - enum_list.push_back( new_enum_list[ii] ); - } - - } - return *this; -} - -/* ==================================================================== */ -/* VIRTUAL INTERFACE */ -/* ==================================================================== */ - -DataType * EnumDataType::clone () const { - return new EnumDataType( *this ); -} - -bool EnumDataType::validate() { - return true; -} - -size_t EnumDataType::getSize() const { - return enumSize; -} - -void* EnumDataType::createInstance(unsigned int num) const { - void* temp = (void*)calloc(num, enumSize); - return temp; -} - -void EnumDataType::deleteInstance(void* address) const { - free(address); -} - -void EnumDataType::clearValue(void * address) const { - - if (enumSize == sizeof(int)) { - *(int*)address = 0; - } else if (enumSize == sizeof(short)) { - *(short*)address = 0; - } else if (enumSize == sizeof(char)) { - *(char*)address = 0; - } else { - std::cerr << "ERROR: Enumeration of size " << enumSize << "is not supported."; - } -} - -void EnumDataType::assignValue(void * address, Value * value) const { - - NumericValue * numeric_value_p = dynamic_cast(value); - if (numeric_value_p) { - - if (enumSize == sizeof(int)) { - *(int*)address = numeric_value_p->getIntegerValue(); - } else if (enumSize == sizeof(short)) { - *(short*)address = numeric_value_p->getIntegerValue(); - } else if (enumSize == sizeof(char)) { - *(char*)address = numeric_value_p->getIntegerValue(); - } else { - std::cerr << "ERROR: Enumeration of size " << enumSize << "is not supported."; - } - } else { - std::cerr << "ERROR: Attempt to assign non-numeric value to a numeric type."; - } -} - -void EnumDataType::printValue(std::ostream &s, void *address) const { - - int value; - - if (enumSize == sizeof(int)) { - value = *(int*)address; - } else if (enumSize == sizeof(short)) { - value = *(short*)address; - } else if (enumSize == sizeof(char)) { - value = *(char*)address; - } else { - std::cerr << "ERROR: Enumeration of size " << enumSize << "is not supported."; - } - - // search the enum_list for the name/value pair. - int enum_count = enum_list.size() ; - int ii = 0; - bool found = false; - while ((ii < enum_count) && !found ) { - if (value == enum_list[ii]->getValue()) { - s << enum_list[ii]->getName(); - found = true; - } - ii ++; - } - if (!found) { - s << value; - } -} - -// MEMBER FUNCTION -std::string EnumDataType::toString() const { - std::stringstream ss; - int enum_count = enum_list.size() ; - ss << "enum {\n"; - for (int ii=0; ii < enum_count ; ii++) { - if (ii) { - ss << ",\n"; - } - ss << enum_list[ii]->toString(); - } - ss << "}\n"; - return ss.str(); -} - - -// MEMBER FUNCTION -std::string EnumDataType::getTypeSpecName() const { - return name; -} - -void EnumDataType::addEnumerator( std::string name, int value) { - - Enumerator* enumerator = new Enumerator( name, value ); - enum_list.push_back(enumerator); - - enumDictionary->addEnumerator(name, value); -} diff --git a/trick_source/sim_services/DataTypes/src/EnumDictionary.cpp b/trick_source/sim_services/DataTypes/src/EnumDictionary.cpp deleted file mode 100644 index b7f0a85ee..000000000 --- a/trick_source/sim_services/DataTypes/src/EnumDictionary.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include -#include "EnumDictionary.hh" - -int EnumDictionary::getValue(std::string name ) { - - enumDictionaryIterator = enumDictionary.find(name); - if (enumDictionaryIterator == enumDictionary.end()) { - std::stringstream error_stream ; - error_stream << "ERROR: Enumerator \"" << name << "\" not defined." << std::endl; - throw std::logic_error( error_stream.str()); - } else { - return( enumDictionaryIterator->second ); - } -} - -void EnumDictionary::addEnumerator(std::string name, int value) { - - enumDictionaryIterator = enumDictionary.find(name); - if (enumDictionaryIterator == enumDictionary.end()) { - enumDictionary[name] = value; - } else { - std::stringstream error_stream ; - error_stream << "ERROR: Attempt to re-define enumerator \"" << name << "\"." << std::endl; - throw std::logic_error( error_stream.str()); - } -} - -// MEMBER FUNCTION -std::string EnumDictionary::toString() { - std::ostringstream oss; - - for ( enumDictionaryIterator = enumDictionary.begin(); - enumDictionaryIterator != enumDictionary.end(); - enumDictionaryIterator++ ) { - - oss << enumDictionaryIterator->first << " = " << enumDictionaryIterator->second << std::endl; - } - return oss.str(); -} - diff --git a/trick_source/sim_services/DataTypes/src/Enumerator.cpp b/trick_source/sim_services/DataTypes/src/Enumerator.cpp deleted file mode 100644 index 199504e98..000000000 --- a/trick_source/sim_services/DataTypes/src/Enumerator.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "Enumerator.hh" -#include "Enumerator.hh" -#include - -Enumerator::Enumerator( std::string name, int value) { - this->name = name; - this->value = value; -} - -Enumerator::Enumerator( const Enumerator& original) { - this->name = original.name; - this->value = original.value; -} - -std::string Enumerator::getName() { - return name; -} - -int Enumerator::getValue() { - return value; -} - -// MEMBER FUNCTION -std::string Enumerator::toString() { - std::ostringstream oss; - oss << getName(); - oss << " = "; - oss << getValue(); - return oss.str(); -} - diff --git a/trick_source/sim_services/DataTypes/src/FloatingPointValue.cpp b/trick_source/sim_services/DataTypes/src/FloatingPointValue.cpp deleted file mode 100644 index 93f8c593c..000000000 --- a/trick_source/sim_services/DataTypes/src/FloatingPointValue.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "FloatingPointValue.hh" -#include "IntegerValue.hh" -#include - -// CONSTRUCTOR -FloatingPointValue::FloatingPointValue(double value) { - this->value = value; -}; - -// MEMBER FUNCTION -void FloatingPointValue::print(std::ostream &s) { - s << value; -} - -// MEMBER FUNCTION -std::string FloatingPointValue::toString() { - std::ostringstream oss; - oss << value; - return oss.str(); -} - -// MEMBER FUNCTION -double FloatingPointValue::getFloatingPointValue() { - return (double)value; -} - -// MEMBER FUNCTION -long long FloatingPointValue::getIntegerValue() { - return (long long)value; -} - diff --git a/trick_source/sim_services/DataTypes/src/IntegerValue.cpp b/trick_source/sim_services/DataTypes/src/IntegerValue.cpp deleted file mode 100644 index 600e22b17..000000000 --- a/trick_source/sim_services/DataTypes/src/IntegerValue.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "IntegerValue.hh" -#include "FloatingPointValue.hh" -#include - -// CONSTRUCTOR -IntegerValue::IntegerValue(long long value) { - this->value = value; -}; - -// MEMBER FUNCTION -void IntegerValue::print(std::ostream &s) { - s << value; -} - -// MEMBER FUNCTION -std::string IntegerValue::toString() { - std::ostringstream oss; - oss << value; - return oss.str(); -} - -// MEMBER FUNCTION -double IntegerValue::getFloatingPointValue() { - return (double)value; -} - -// MEMBER FUNCTION -long long IntegerValue::getIntegerValue() { - return (long long)value; -} - diff --git a/trick_source/sim_services/DataTypes/src/LexicalAnalyzer.cpp b/trick_source/sim_services/DataTypes/src/LexicalAnalyzer.cpp deleted file mode 100644 index ac8f6db7e..000000000 --- a/trick_source/sim_services/DataTypes/src/LexicalAnalyzer.cpp +++ /dev/null @@ -1,150 +0,0 @@ -#include "LexicalAnalyzer.hh" -#include - -struct { - const char * key; - Token::e token; -} keytable[] = { - {"void", Token::Void}, - {"bool", Token::Boolean}, - {"char", Token::Char}, - {"short", Token::Short}, - {"int", Token::Int}, - {"long", Token::Long}, - {"wchar_t", Token::WideChar}, - {"signed", Token::Signed}, - {"unsigned", Token::Unsigned}, - {"float", Token::Float}, - {"double", Token::Double} -}; - -typedef enum { - BEGINNING = 0, - ID_COLLECTION = 1, - INT_COLLECTION = 2, - DONE = 3 -} LexState; - -#define NKEYS ( sizeof keytable / sizeof keytable[0] ) - - -LexicalAnalyzer::LexicalAnalyzer() { - - lexemeText.clear(); - token = Token::EndOfFile; -} - -void LexicalAnalyzer::load( const std::string& s ) { - - inStream << s; - lexemeText.clear(); - inStream >> std::noskipws >> nextChar; - token = nextToken(); -} - -Token::e LexicalAnalyzer::matchToken(Token::e expectedToken) { - if ( token == expectedToken) { - token = nextToken(); - return token; - } else { - std::cerr << "Syntax Error. Expected token(" << expectedToken << ")." - << " Found token(" << token << ") instead." << std::endl; - return Token::Error; - } -} - -std::string LexicalAnalyzer::getText() { - return lexemeText; -} - -Token::e LexicalAnalyzer::getToken() { - return token; -} - -Token::e LexicalAnalyzer::nextToken() { - - token = Token::EndOfFile; - lexemeText = "EOF"; - - LexState state = BEGINNING; - - while ( !inStream.eof() && state != DONE ) { - - switch ( state ) { - - case BEGINNING : { - if ( isalpha( nextChar ) ) { - lexemeText = nextChar; - inStream >> std::noskipws >> nextChar; - token = Token::Identifier; - state = ID_COLLECTION; - } else if ( isdigit( nextChar )) { - lexemeText = nextChar; - inStream >> std::noskipws >> nextChar; - token = Token::Integer; - state = INT_COLLECTION; - } else if ( isspace( nextChar )) { - inStream >> std::noskipws >> nextChar; - } else if ( nextChar == '*') { - lexemeText = nextChar; - inStream >> std::noskipws >> nextChar; - token = Token::Asterisk; - state = DONE; - } else if ( nextChar == '(') { - lexemeText = nextChar; - inStream >> std::noskipws >> nextChar; - token = Token::LeftParen; - state = DONE; - } else if ( nextChar == ')') { - lexemeText = nextChar; - inStream >> std::noskipws >> nextChar; - token = Token::RightParen; - state = DONE; - } else if ( nextChar == '[') { - lexemeText = nextChar; - inStream >> std::noskipws >> nextChar; - token = Token::LeftBracket; - state = DONE; - } else if ( nextChar == ']') { - lexemeText = nextChar; - inStream >> std::noskipws >> nextChar; - token = Token::RightBracket; - state = DONE; - } else { - token = Token::Error; - state = DONE; - } - } break; - - case ID_COLLECTION : { - - while (!inStream.eof() && isalnum(nextChar)) { - lexemeText += nextChar; - inStream >> std::noskipws >> nextChar; - } - for (int ii=0; ii < NKEYS; ii++) { - if ( lexemeText.compare( keytable[ii].key ) == 0 ) { - token = keytable[ii].token; - break; - } - } - state = DONE; - } break; - - case INT_COLLECTION : { - while (!inStream.eof() && isdigit(nextChar)) { - lexemeText += nextChar; - inStream >> std::noskipws >> nextChar; - } - state = DONE; - } break; - - default: { - state = DONE; - token = Token::Error; - } - - } - } - return token; -} diff --git a/trick_source/sim_services/DataTypes/src/MemMgr.cpp b/trick_source/sim_services/DataTypes/src/MemMgr.cpp deleted file mode 100644 index a2428dd80..000000000 --- a/trick_source/sim_services/DataTypes/src/MemMgr.cpp +++ /dev/null @@ -1,390 +0,0 @@ -#include "MemMgr.hh" -#include "ClassicChkPtAgent.hh" -#include "AllocInfo.hh" -#include "TypeDictionary.hh" -#include "ArrayDataType.hh" -#include "ParsedDeclaration.hh" -#include -#include - -// Constructor -MemMgr::MemMgr() { - - debugLevel = 0; - reducedCheckpoint = true; - hexfloatCheckpoint = false; - compactArraysCheckpoint = true; - - defaultCheckPointAgent = new ClassicChkPtAgent( std::cout ); - defaultCheckPointAgent->setDebugLevel( debugLevel); - defaultCheckPointAgent->setReducedCheckpoint( reducedCheckpoint); - defaultCheckPointAgent->setHexfloatCheckpoint( hexfloatCheckpoint); - defaultCheckPointAgent->setMakeCompactArrays( compactArraysCheckpoint ); - - currentCheckPointAgent = defaultCheckPointAgent; - - typeDictionary = new TypeDictionary(); -} - -// MEMBER FUNCTION -void* MemMgr::declare_var( const std::string& typeSpecifier, - const std::string& variableName, - unsigned int dimensionsCount, - int* dimensions, - void* suppliedAllocation ) { - - if ( var_exists( variableName )) { - std::cerr << "ERROR: Variable " << variableName << " already declared." << std::endl; - return ((void*)NULL); - } - - AllocInfo* newAllocInfo; - void* actualAllocation; - try { - // FIXME: MUTEX LOCK to protect AllocInfo static variables - newAllocInfo = new AllocInfo( variableName, - typeSpecifier, - dimensionsCount, - dimensions, - typeDictionary, - suppliedAllocation ); - actualAllocation = newAllocInfo->getStart(); - allocInfoByAddressMap[actualAllocation] = newAllocInfo; - allocInfoByNameMap[variableName] = newAllocInfo; - } catch ( std::logic_error e ) { - // FIXME: MUTEX UNLOCK - std::cerr << e.what(); - newAllocInfo = (AllocInfo*)NULL; - actualAllocation = (void*)NULL; - } - if ( debugLevel ) { - if ( newAllocInfo == (AllocInfo*)NULL ) { - std::cout << "Allocation Failed." << std::endl; - } else { - std::cout << newAllocInfo->toString() << std::endl; - } - } - return( actualAllocation ); -} - -// MEMBER FUNCTION -void* MemMgr::declare_var( const std::string& declaration, - void* suppliedAllocation ) { - - ParsedDeclaration* typeName = new ParsedDeclaration( declaration); - std::string typeSpecifier = typeName->getTypeSpecifier(); - std::string variableName = typeName->getVariableName(); - - unsigned int dimensionsCount = typeName->getNumberOfDimensions(); - int dimensions[16]; - for (int ii=0 ; ii < dimensionsCount; ii++) { - dimensions[ii] = typeName->getDimensionSize(ii); - } - void* actualAllocation = declare_var( typeSpecifier, variableName, dimensionsCount, dimensions, suppliedAllocation ); - return actualAllocation; -} - -// MEMBER FUNCTION -void* MemMgr::declare_var( const std::string& typeSpecName, - const std::string& variableName, - int n, - void* suppliedAllocation) { - - void* actualAllocation = declare_var(typeSpecName, variableName, 1, &n, suppliedAllocation ); - return actualAllocation; -} - -// MEMBER FUNCTION -void* MemMgr::declare_var( const std::string& typeSpecName, - int n, - void* suppliedAllocation ) { - void* actualAllocation = declare_var(typeSpecName, "", 1, &n, suppliedAllocation); - return actualAllocation; -} - -// MEMBER FUNCTION -void* MemMgr::resize_var( void* address, size_t newElementCount) { - void* newAddress; - AllocInfo* allocInfo = getAllocInfoOf(address); - if (allocInfo != NULL) { - newAddress = allocInfo->resize( newElementCount ); - } else { - std::cerr << __FUNCTION__ << " failed. Address (" << address << ") not in Trick managed memory." << std::endl; - newAddress = NULL; - } - return newAddress; -} - -// MEMBER FUNCTION -void* MemMgr::resize_var( const std::string& name, size_t newElementCount) { - void* newAddress; - AllocInfo* allocInfo = getAllocInfoNamed(name); - if (allocInfo != NULL) { - newAddress = allocInfo->resize( newElementCount ); - } else { - std::cerr << __FUNCTION__ << " failed. Name \"" << name << "\" not in Trick managed memory." << std::endl; - newAddress = NULL; - } - return newAddress; -} - -// MEMBER FUNCTION -// void* resize_var( const char* name, int num); - - -// MEMBER FUNCTION -bool MemMgr::var_exists( const std::string& variableName) { - - if ( !variableName.empty()) { - AllocInfo* allocInfo = getAllocInfoNamed( variableName ); - if ( allocInfo != (AllocInfo*)NULL ) { - return true; - } - } - return false; -} - -// MEMBER FUNCTION -void MemMgr::clear_var( void* address) { - - AllocInfo* allocInfo; - if ((allocInfo = getAllocInfoOf( address)) != NULL) { - allocInfo->clear(); - } else { - std::stringstream ss; - ss << "Cannot clear the variable at address "; - ss << address; - ss << " because memory manager knows nothing about it."; - ss << std::endl; - std::cerr << ss.str(); - } -} - -// MEMBER FUNCTION -void MemMgr::clear_var( const std::string& variableName) { - - AllocInfo* allocInfo; - if ((allocInfo = getAllocInfoNamed( variableName )) != NULL) { - allocInfo->clear(); - } else { - std::stringstream ss; - ss << "Cannot clear the variable named "; - ss << variableName; - ss << " because memory manager knows nothing about it."; - ss << std::endl; - std::cerr << ss.str(); - } -} - -// MEMBER FUNCTION -void MemMgr::clear_all_vars() { -} - -// MEMBER FUNCTION -void MemMgr::write_checkpoint( std::ostream& out_s) { - - AllocInfo* allocInfo; - std::vector allocInfoList; - std::map::iterator pos; - - pthread_mutex_lock(&allocInfoMapMutex); - - for ( pos = allocInfoByAddressMap.begin() ; pos != allocInfoByAddressMap.end() ; pos++ ) { - allocInfo = pos->second; - allocInfoList.push_back(allocInfo); - } - write_checkpoint( out_s, allocInfoList); - - pthread_mutex_unlock(&allocInfoMapMutex); -} - -// MEMBER FUNCTION -void MemMgr::write_checkpoint( const std::string& filename) { - - std::ofstream out_s( filename.c_str(), std::ios::out); - if (out_s.is_open()) { - write_checkpoint( out_s ); - } else { - std::cerr << "ERROR: Couldn't open \""<< filename <<"\"." << std::endl; - std::cerr.flush(); - } -} - -// MEMBER FUNCTION -void MemMgr::write_checkpoint( std::ostream& out_s, const std::string& variableName) { - - std::vector dependencies; - pthread_mutex_lock(&allocInfoMapMutex); - AllocInfo * allocInfo = getAllocInfoNamed( variableName ); - if ( allocInfo != NULL ) { - allocInfo->appendDependencies( this, dependencies ); - } - pthread_mutex_unlock(&allocInfoMapMutex); - write_checkpoint( out_s, dependencies); -} - -// MEMBER FUNCTION -void MemMgr::write_checkpoint(const std::string& filename, const std::string& variableName) { - - std::ofstream out_s( filename.c_str(), std::ios::out); - if (out_s.is_open()) { - write_checkpoint( out_s, variableName); - } else { - std::cerr << "ERROR: Couldn't open \""<< filename <<"\"." << std::endl; - std::cerr.flush(); - } -} - -// MEMBER FUNCTION -void MemMgr::write_checkpoint( std::ostream& out_s, std::vector& variableNameList) { - - std::vector dependencies; - const char* variableName; - int nameCount; - nameCount = variableNameList.size(); - for (int ii=0; ii< nameCount; ii++) { - variableName = variableNameList[ii]; - pthread_mutex_lock(&allocInfoMapMutex); - AllocInfo* allocInfo = getAllocInfoNamed( variableName ); - if ( allocInfo != NULL ) { - allocInfo->appendDependencies( this, dependencies ); - } - pthread_mutex_unlock(&allocInfoMapMutex); - } - write_checkpoint( out_s, dependencies); -} - -// MEMBER FUNCTION -void MemMgr::write_checkpoint(const std::string& filename, std::vector& variableNameList) { - - std::ofstream out_s( filename.c_str(), std::ios::out); - if (out_s.is_open()) { - write_checkpoint( out_s, variableNameList ); - } else { - std::cerr << "ERROR: Couldn't open \""<< filename <<"\"." << std::endl; - std::cerr.flush(); - } -} - -// STATIC FUNCTION -static bool allocInfoCompare( AllocInfo* lhs, AllocInfo* rhs ) { - bool result; - StorageClass::e lhsStorageClass = lhs->getStorageClass(); - StorageClass::e rhsStorageClass = rhs->getStorageClass(); - unsigned int lhsSerialNumber = lhs->getSerialNumber(); - unsigned int rhsSerialNumber = rhs->getSerialNumber(); - - if ( lhsStorageClass == rhsStorageClass ) { - result = ( lhsSerialNumber < rhsSerialNumber ); - } else if ( lhsStorageClass == StorageClass:: EXTERN ) { - result = true; - } else { - result = false; - } - return result; -} - -// PRIVATE MEMBER FUNCTION -void MemMgr::write_checkpoint(std::ostream& outStream, std::vector& allocInfoList) { - - std::sort( allocInfoList.begin(), allocInfoList.end(), allocInfoCompare ) ; - - // 2) Generate declaration statements for each the local allocations. - outStream << "// Variable Declarations." << std::endl; - outStream.flush(); - - int itemCount = allocInfoList.size(); - - for (int ii = 0 ; ii < itemCount ; ii ++) { - AllocInfo * allocInfo = allocInfoList[ii]; - StorageClass::e storageClass = allocInfo->getStorageClass(); - if ( storageClass == StorageClass::LOCAL) { - std::string name = allocInfo->getName(); - if ( !name.empty() ) { - currentCheckPointAgent->writeDeclaration( outStream, name, allocInfo->getDataType() ); - } else { - currentCheckPointAgent->writeDeclaration( outStream, allocInfo->getSerialName(), allocInfo->getDataType() ); - } - } - } - - // 3) Write a "clear_all_vars" command. - outStream << std::endl << std::endl << "// Clear all allocations to 0." << std::endl; - outStream << "clear_all_vars();" << std::endl; - - // 4) Dump the contents of each of the local and extern allocations. - outStream << std::endl << std::endl << "// Variable Assignments." << std::endl; - outStream.flush(); - - for (int ii = 0 ; ii < itemCount ; ii ++) { - AllocInfo * allocInfo = allocInfoList[ii]; - - std::string name = allocInfo->getName(); - if ( !name.empty() ) { - currentCheckPointAgent->pushName( name ); - currentCheckPointAgent->writeVariable( outStream, this, allocInfo->getStart(), allocInfo->getDataType() ); - } else { - currentCheckPointAgent->pushName( allocInfo->getSerialName() ); - currentCheckPointAgent->writeVariable( outStream, this, allocInfo->getStart(), allocInfo->getDataType() ); - } - currentCheckPointAgent->popNameElement(); - outStream << std::endl; - } -} - -// MEMBER FUNCTION -AllocInfo* MemMgr::getAllocInfoOf( void* address ) { - AllocInfo* allocInfo; - std::map::iterator pos; - for ( pos = allocInfoByAddressMap.begin() ; pos != allocInfoByAddressMap.end() ; pos++ ) { - allocInfo = pos->second; - if ( allocInfo->contains( address )) { - return allocInfo; - } - } - return NULL; -} - -// MEMBER FUNCTION -AllocInfo* MemMgr::getAllocInfoAt( void* address ) { - std::map::iterator pos; - pos = allocInfoByAddressMap.find( address ); - if ( pos == allocInfoByAddressMap.end()) { - return NULL; - } else { - return pos->second; - } -} - -// MEMBER FUNCTION -AllocInfo* MemMgr::getAllocInfoNamed( const std::string& name ) { - std::map::iterator pos; - pos = allocInfoByNameMap.find(name); - if ( pos == allocInfoByNameMap.end()) { - return NULL; - } else { - return pos->second; - } -} - - -// MEMBER FUNCTION -const DataType* MemMgr::getDataType( std::string typeName ) { - return typeDictionary->getDataType(typeName); -} - -#if NEWSTUFF -void * MemMgr::getVarAccessInfo( const std::string& variableName, VarAccessInfo& varAccessInfo ) { - - std::string varName = variableName; - // Get identifier at beginnning of the string and the remiander. - // Find the AllocInfoByName ( identifier ); - - AllocInfo* allocInfo = getAllocInfoNamed (variableName); - if (allocInfo != NULL) { - } - returnAddress = alloc->getVarAccessInfo( varName, varAccessInfo ); - - return returnAddress; -} -#endif diff --git a/trick_source/sim_services/DataTypes/src/NormalStructMember.cpp b/trick_source/sim_services/DataTypes/src/NormalStructMember.cpp deleted file mode 100644 index 7c6baf749..000000000 --- a/trick_source/sim_services/DataTypes/src/NormalStructMember.cpp +++ /dev/null @@ -1,143 +0,0 @@ -#include "NormalStructMember.hh" -#include "TypeDictionary.hh" -#include "ArrayDataType.hh" -#include -#include - -// CONSTRUCTOR -NormalStructMember::NormalStructMember(std::string memberName, - int offset, - TypeDictionary* typeDictionary, - std::string typeSpecName, - unsigned int n_dims, - int dims[] ) : StructMember(memberName) { - - if ( n_dims > 0 ) { - this->typeSpecName.clear(); - declDataType = new ArrayDataType( typeDictionary, typeSpecName, n_dims, dims); - } else { - this->typeSpecName = typeSpecName; - declDataType = NULL; - } - - subType = NULL; - byte_offset = offset; - is_valid = false; - this->typeDictionary = typeDictionary; -} - -// CONSTRUCTOR -NormalStructMember::NormalStructMember ( const NormalStructMember & original ) - :StructMember( original ) { - - byte_offset = original.byte_offset; - is_valid = original.is_valid; - typeSpecName = original.typeSpecName; - - if ( original.declDataType != NULL) { - declDataType = original.declDataType->clone(); - } else { - declDataType = NULL; - } - - if (is_valid) { - if (typeSpecName.empty()) { - subType = declDataType; - } else { - subType = original.subType; - } - } -} - -StructMember * NormalStructMember::clone () const { - return new NormalStructMember( *this ); -} - -NormalStructMember::~NormalStructMember() { - if (declDataType != NULL) { - delete declDataType; - } -} - -bool NormalStructMember::validate() { - - if (!is_valid) { - if (typeSpecName.empty()) { - is_valid = declDataType->validate(); - if (is_valid) { - subType = declDataType; - } - } else { - subType = typeDictionary->getDataType( typeSpecName ); - - if (subType != NULL) { - is_valid = true; - } else { - std::cerr << "ERROR: Type \"" << typeSpecName - << "\" not found in the TypeDictionary." << std::endl; - } - } - } - return is_valid; -} - -// MEMBER FUNCTION -bool NormalStructMember::containsPointers() const { - if (is_valid) { - return subType->containsPointers(); - } - return false; -} - -// MEMBER FUNCTION -const DataType * NormalStructMember::getDataType() { - return subType; -} - -// MEMBER FUNCTION -int NormalStructMember::getOffset() { - return byte_offset; -} - -// MEMBER FUNCTION -void NormalStructMember::clearValue(void *struct_address ) const { - - if (is_valid) { - void * member_address = (char*)struct_address + byte_offset; - subType->clearValue( member_address); - } else { - std::cerr << "ERROR: Attempt to clear a value via unvalidate DataType." << std::endl; - } -} - -// MEMBER FUNCTION -void NormalStructMember::assignValue(void *struct_address, Value *v ) const { - - if (is_valid) { - void * member_address = (char*)struct_address + byte_offset; - subType->assignValue( member_address, v); - } else { - std::cerr << "ERROR: Attempt to assign a value via unvalidate DataType." << std::endl; - } -} - -// MEMBER FUNCTION -void NormalStructMember::printValue(std::ostream &s, void *struct_address) const { - if (is_valid) { - void * member_address = (char*)struct_address + byte_offset; - subType->printValue(s, member_address) ; - } else { - std::cerr << "ERROR: Attempt to print a value via unvalidate DataType." << std::endl; - } -} - -// MEMBER FUNCTION -std::string NormalStructMember:: toString() const { - std::ostringstream oss; - if (! typeSpecName.empty()) { - oss << typeSpecName << " " << getName(); - } else { - oss << subType->makeDeclaration( getName(), true); - } - return oss.str(); -} diff --git a/trick_source/sim_services/DataTypes/src/ParsedDeclaration.cpp b/trick_source/sim_services/DataTypes/src/ParsedDeclaration.cpp deleted file mode 100644 index a7eaf346b..000000000 --- a/trick_source/sim_services/DataTypes/src/ParsedDeclaration.cpp +++ /dev/null @@ -1,277 +0,0 @@ -#include "ParsedDeclaration.hh" -#include "LexicalAnalyzer.hh" -#include - -/* - type-name: type-specifier - | type-specifier declarator - ; - - declarator : pointer - | pointer direct-declarator - | direct-declarator - ; - - direct-declarator: identifier - | ( declarator ) - | [ constant-exp ] - | [ ] - | direct-declarator [ constant-exp ] - | direct-declarator [ ] - ; -*/ - -// CONSTRUCTOR -ParsedDeclaration::ParsedDeclaration( std::string s ) { - typeSpec.clear(); - varName.clear(); - ndims = 0; - for (int ii = 0; ii < MAX_DIMS; ii++){ - dims[ii] = 0; - } - lexer.load(s); - parseDeclaration(); -} - -// =============================================== -// type-name: type-specifier -// | type-specifier declarator -// ; -// =============================================== -bool ParsedDeclaration::parseDeclaration() { - - std::cout << __FUNCTION__ << std::endl; - bool errorCondition = parseTypeSpecifier(); - if ( !errorCondition ) { - Token::e token = lexer.getToken(); - if ((token == Token::Asterisk) || - (token == Token::Identifier ) || - (token == Token::LeftParen ) || - (token == Token::LeftBracket)) { - errorCondition = parseDeclarator(); - } - if (lexer.matchToken(Token::EndOfFile) == Token::Error) { - errorCondition = true; - } - } - return errorCondition; -} - -// ============================================================== -// declarator : pointer -// | pointer direct-declarator -// | direct-declarator -// ; -// -// NOTE: a pointer is one or more asterisks. -// ============================================================== -bool ParsedDeclaration::parseDeclarator() { - - std::cout << __FUNCTION__ << std::endl; - bool errorCondition = false; - int asteriskCount = 0; - - Token::e token = lexer.getToken(); - while (token == Token::Asterisk ) { - token = lexer.matchToken( Token::Asterisk ); - asteriskCount ++; - } - if ((token == Token::LeftParen) || (token == Token::LeftBracket) || (token == Token::Identifier)) { - errorCondition |= parseDirectDeclarator(); - } - - if (asteriskCount != 0) { - for (int ii=0 ; ii < asteriskCount ; ii++) { - dims[ndims] = -1; - ndims ++; - } - } - return errorCondition; -} - -// ============================================================== -// direct-declarator: identifier -// | ( declarator ) -// | [ integer ] -// | direct-declarator [ integer ] -// ; -// ============================================================== -bool ParsedDeclaration::parseDirectDeclarator() { - - std::cout << __FUNCTION__ << std::endl; - bool errorCondition = false; - - Token::e token = lexer.getToken(); - if (token == Token::Identifier) { - varName = lexer.getText(); - token = lexer.matchToken( Token::Identifier ); - } else if (token == Token::LeftParen) { - token = lexer.matchToken( Token::LeftParen ); - errorCondition |= parseDeclarator(); - if ( !errorCondition ) { - if ((token = lexer.matchToken( Token::RightParen )) == Token::Error) { - errorCondition = true; - } - } - } else if (token == Token::LeftBracket) { - token = lexer.matchToken( Token::LeftBracket ); - if (token == Token::Integer) { - dims[ndims] = std::atoi( (lexer.getText()).c_str() ); - ndims ++; - token = lexer.matchToken(Token::Integer); - } - if ((token = lexer.matchToken( Token::RightBracket )) == Token::Error) { - errorCondition = true; - } - } else { - // Note: this is the case of an anonymous declaration. - varName.clear(); - } - - while (token == Token::LeftBracket) { - token = lexer.matchToken( Token::LeftBracket ); - if (token == Token::Integer) { - dims[ndims] = std::atoi( (lexer.getText()).c_str() ); - ndims ++; - token = lexer.matchToken(Token::Integer); - } - if ((token = lexer.matchToken( Token::RightBracket )) == Token::Error) { - errorCondition = true; - } - } - return errorCondition; -} - -bool ParsedDeclaration::parseTypeSpecifier() { - - std::cout << __FUNCTION__ << std::endl; - bool errorCondition = false; - Token::e token = lexer.getToken(); - - switch ( token ) { - case Token::Void : { - token = lexer.matchToken(Token::Void); - typeSpec = "void"; - } break; - case Token::Boolean : { - token = lexer.matchToken(Token::Boolean); - typeSpec = "bool"; - } break; - case Token::Char : { - token = lexer.matchToken(Token::Char); - typeSpec = "char"; - } break; - case Token::Short : { - token = lexer.matchToken(Token::Short); - typeSpec = "short"; - } break; - case Token::Int : { - token = lexer.matchToken(Token::Int); - typeSpec = "int"; - } break; - case Token::Long : { - token = lexer.matchToken(Token::Long); - if (token == Token::Long) { - token = lexer.matchToken(Token::Long); - typeSpec = "long long"; - } else { - typeSpec = "long"; - } - } break; - case Token::Unsigned : { - token = lexer.matchToken(Token::Unsigned); - switch ( token ) { - case Token::Char : { - token = lexer.matchToken(Token::Char); - typeSpec = "unsigned char"; - } break; - case Token::Short : { - token = lexer.matchToken(Token::Short); - typeSpec = "unsigned short"; - } break; - case Token::Int : { - token = lexer.matchToken(Token::Int); - typeSpec = "unsigned int"; - } break; - case Token::Long : { - token = lexer.matchToken(Token::Long); - if (token == Token::Long) { - token = lexer.matchToken(Token::Long); - typeSpec = "unsigned long long"; - } else { - typeSpec = "unsigned long"; - } - } break; - default: { - typeSpec = "unsigned int"; - } - } - } break; - case Token::Signed : { - token = lexer.matchToken(Token::Signed); - switch ( token ) { - case Token::Char : { - token = lexer.matchToken(Token::Char); - typeSpec = "char"; - } break; - case Token::Short : { - token = lexer.matchToken(Token::Short); - typeSpec = "short"; - } break; - case Token::Int : { - token = lexer.matchToken(Token::Int); - typeSpec = "int"; - } break; - case Token::Long : { - token = lexer.matchToken(Token::Long); - if (token == Token::Long) { - token = lexer.matchToken(Token::Long); - typeSpec = "long long"; - } else { - typeSpec = "long"; - } - } break; - default: { - typeSpec = "int"; - } - } - } break; - case Token::WideChar : { - token = lexer.matchToken(Token::WideChar); - typeSpec = "wchar_t"; - } break; - case Token::Float : { - token = lexer.matchToken(Token::Float); - typeSpec = "float"; - } break; - case Token::Double : { - token = lexer.matchToken(Token::Double); - typeSpec = "double"; - } break; - case Token::Identifier : { - token = lexer.matchToken(Token::Identifier); - typeSpec = lexer.getText(); - } break; - default : { - errorCondition = true; - } - } - return errorCondition; -} - -std::string ParsedDeclaration::getTypeSpecifier() { - return typeSpec; -} - -std::string ParsedDeclaration::getVariableName() { - return varName; -} - -unsigned int ParsedDeclaration::getNumberOfDimensions() { - return ndims; -} - -int ParsedDeclaration::getDimensionSize( unsigned int index) { - // FIXME: needs bounds checking. - return dims[index]; -} diff --git a/trick_source/sim_services/DataTypes/src/PointerDataType.cpp b/trick_source/sim_services/DataTypes/src/PointerDataType.cpp deleted file mode 100644 index 0caf4afe1..000000000 --- a/trick_source/sim_services/DataTypes/src/PointerDataType.cpp +++ /dev/null @@ -1,211 +0,0 @@ -#include "PointerDataType.hh" -#include "ArrayDataType.hh" -#include "TypeDictionary.hh" -#include "PointerValue.hh" -#include "CompositeValue.hh" -#include -#include -#include // for free() - - - -bool PointerDataType::initPointerDataType( TypeDictionary * typeDictionary, std::string typeSpecName, unsigned int n_dims, int dims[]) { - - bool errorCondition = false; - // NOTE: (dim[0] < 0) indicates a pointer. (dim[0] >= 0) indicates an array. - if (( n_dims >= 1 ) && ( dims[0] < 0 )) { - if ( n_dims == 1 ) { - this->typeSpecName = typeSpecName; - ownDataType = NULL; - this->subType = NULL; - } else if (n_dims > 1) { - this->typeSpecName.clear(); - if (dims[1] < 0) { - this->ownDataType = new PointerDataType( typeDictionary, typeSpecName, n_dims-1, &dims[1] ); - } else { - this->ownDataType = new ArrayDataType( typeDictionary, typeSpecName, n_dims-1, &dims[1] ); - } - this->subType = ownDataType; - } - is_valid = false; - this->typeDictionary = typeDictionary; - } else { - errorCondition= true; - } - return errorCondition; -} - -// CONSTRUCTOR -PointerDataType:: PointerDataType( TypeDictionary * typeDictionary, std::string typeSpecName, unsigned int n_dims, int dims[]) { - - if( this->initPointerDataType( typeDictionary, typeSpecName, n_dims, dims) ) { - throw std::logic_error("PointerDataType constructor(1) error."); - } -} - -// CONSTRUCTOR -PointerDataType::PointerDataType( TypeDictionary* typeDictionary, std::string typeSpecifierName) { - - int dims[1] = {-1}; - if( this->initPointerDataType( typeDictionary, typeSpecName, 1, dims) ) { - throw std::logic_error("PointerDataType constructor(2) error."); - } -} - -// COPY CONSTRUCTOR -PointerDataType::PointerDataType ( PointerDataType const & original) { - - is_valid = original.is_valid; - typeSpecName = original.typeSpecName; - typeDictionary = original.typeDictionary; - - if (original.ownDataType != NULL) { - ownDataType = original.ownDataType->clone(); - } else { - ownDataType = NULL; - } - - if ( typeSpecName.empty()) { - subType = ownDataType; - } else { - if ( is_valid ) { - subType = original.subType; - } else { - subType = NULL; - } - } -} - -// DESTRUCTOR -PointerDataType::~PointerDataType () { - - if ( typeSpecName.empty()) { - delete subType; - } -} - -// ASSIGNMENT OPERATOR -PointerDataType& PointerDataType::operator=( const PointerDataType & rhs ) { - - if ( this != &rhs ) { - - // Copy the RHS members before messing with the LHS. - DataType *clonedDataType; - if ( rhs.typeSpecName.empty() ) { - clonedDataType = rhs.subType->clone(); - } - - // Delete any pre-existing LHS members. - if ( typeSpecName.empty() ) { - delete subType; - } - - // Assign the copied RHS members to the LHS. - elementCount = rhs.elementCount; - is_valid = rhs.is_valid; - typeSpecName = rhs.typeSpecName; - - if ( typeSpecName.empty() ) { - subType = clonedDataType; - } else { - subType = rhs.subType; - } - } - return *this; -} - -// MEMBER FUNCTION -// FIXME: make sure that this method in other DataTypes checks for PointerData types rather than ArrayDataTypes. -bool PointerDataType::containsPointers() const { - return true; -} - -// CLONE -DataType * PointerDataType::clone () const { - return new PointerDataType( *this ); -} - -// MEMBER FUNCTION -bool PointerDataType::validate() { - - if (!is_valid) { - // if we're not referencing a dictionary type. - if (typeSpecName.empty()) { - is_valid = ownDataType->validate(); - if (is_valid) { - subType = ownDataType; - } - } else { - subType = typeDictionary->getDataType( typeSpecName ); - if (subType != NULL) { - is_valid = true; - } else { - std::cerr << "ERROR: Type \"" << typeSpecName << "\" not found." << std::endl; - } - } - } - return is_valid; -} - -// MEMBER FUNCTION -size_t PointerDataType::getSize() const { - return sizeof(void*); -} - -// MEMBER FUNCTION -void* PointerDataType::createInstance(unsigned int num) const { - void* temp = calloc(num, sizeof(void*)); - return temp; -} - -// MEMBER FUNCTION -void PointerDataType::deleteInstance(void* address) const { - free(address); -} - -// MEMBER FUNCTION -void PointerDataType::clearValue(void * address) const { - *(void**)address = (void*)NULL; -} - -// MEMBER FUNCTION -void PointerDataType::assignValue(void * address, Value*value) const { - - PointerValue * pointer_value_p = dynamic_cast(value); - if (pointer_value_p) { - *(void**)address = pointer_value_p->getPointer(); - } else { - std::cerr << "ERROR: Attempt to assign non-pointer value to a pointer."; - } -} - -// MEMBER FUNCTION -void PointerDataType::printValue(std::ostream &s, void * address) const { - s << *(void**)address; -} - -// MEMBER FUNCTION -std::string PointerDataType::getTypeSpecName() const { - return typeSpecName; -} - -// MEMBER FUNCTION -std::string PointerDataType::makeDeclaration(std::string declarator, bool isDirectDeclarator) const { - std::string outTypeName; - std::stringstream ss; - - ss << "*" << declarator ; - if (subType != NULL) { - outTypeName = subType->makeDeclaration( ss.str(), false ); - } else { - outTypeName = getTypeSpecName() + ss.str(); - } - return outTypeName; -} - -// MEMBER FUNCTION -const DataType * PointerDataType::getSubType() const { - return subType; -} - - diff --git a/trick_source/sim_services/DataTypes/src/PointerValue.cpp b/trick_source/sim_services/DataTypes/src/PointerValue.cpp deleted file mode 100644 index 3ecd6f133..000000000 --- a/trick_source/sim_services/DataTypes/src/PointerValue.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "PointerValue.hh" -#include - -// CONSTRUCTOR -PointerValue::PointerValue(void * value) { - this->value = value; -} - -// MEMBER FUNCTION -void* PointerValue::getPointer() { - return value; -} - -// MEMBER FUNCTION -void PointerValue::print(std::ostream &s) { - s << value; -} - -// MEMBER FUNCTION -std::string PointerValue::toString() { - std::ostringstream oss; - oss << value; - return oss.str(); -} diff --git a/trick_source/sim_services/DataTypes/src/PrimitiveDataType.cpp b/trick_source/sim_services/DataTypes/src/PrimitiveDataType.cpp deleted file mode 100644 index 2710a9560..000000000 --- a/trick_source/sim_services/DataTypes/src/PrimitiveDataType.cpp +++ /dev/null @@ -1,118 +0,0 @@ -#include "PrimitiveDataType.hh" -#include -#include - -/* - Template specializations for PrimitiveDataType::getTypeSpecName() - */ -template <> std::string PrimitiveDataType::getTypeSpecName() const { - std::string s("void"); return s; -} -template <> std::string PrimitiveDataType::getTypeSpecName() const { - std::string s("char"); return s; -} -template <> std::string PrimitiveDataType::getTypeSpecName() const { - std::string s("short"); return s; -} -template <> std::string PrimitiveDataType::getTypeSpecName() const { - std::string s("int"); return s; -} -template <> std::string PrimitiveDataType::getTypeSpecName() const { - std::string s("long"); return s; -} -template <> std::string PrimitiveDataType::getTypeSpecName() const { - std::string s("wchar_t"); return s; -} -template <> std::string PrimitiveDataType::getTypeSpecName() const { - std::string s("long long"); return s; -} -template <> std::string PrimitiveDataType::getTypeSpecName() const { - std::string s("unsigned char"); return s; -} -template <> std::string PrimitiveDataType::getTypeSpecName() const { - std::string s("unsigned short"); return s; -} -template <> std::string PrimitiveDataType::getTypeSpecName() const { - std::string s("unsigned int"); return s; -} -template <> std::string PrimitiveDataType::getTypeSpecName() const { - std::string s("unsigned long"); return s; -} -template <> std::string PrimitiveDataType::getTypeSpecName() const { - std::string s("unsigned long long"); return s; -} -template <> std::string PrimitiveDataType::getTypeSpecName() const { - std::string s("float"); return s; -} -template <> std::string PrimitiveDataType::getTypeSpecName() const { - std::string s("double"); return s; -} - -/* - Template specializations for PrimitiveDataType::isFloatingPoint() - */ -template <> bool PrimitiveDataType::isFloatingPoint() const { return true; } -template <> bool PrimitiveDataType::isFloatingPoint() const { return true; } - -/* - Template specializations for PrimitiveDataType::isSigned() - */ -template <> bool PrimitiveDataType::isSigned() const { return true; } -template <> bool PrimitiveDataType::isSigned() const { return true; } -template <> bool PrimitiveDataType::isSigned() const { return true; } -template <> bool PrimitiveDataType::isSigned() const { return true; } -template <> bool PrimitiveDataType::isSigned() const { return true; } - -/* - Template specializations for PrimitiveDataType::isVoid() - */ -template <> bool PrimitiveDataType::isVoid() const { return true; } - -/* - Template specializations for PrimitiveDataType::printValue() -*/ -template <> void PrimitiveDataType::printValue(std::ostream &s, void *address ) const { - if (isprint( (int)*(char*)address) ) { - s << "'" << *(char*)address << "'"; - } else { - s << (int)*(char*)address; - } -} - -template <> void PrimitiveDataType::printValue(std::ostream &s, void *address ) const { - if (isprint( (int)*(unsigned char*)address) ) { - s << "'" << *(unsigned char*)address << "'"; - } else { - s << (int)*(unsigned char*)address; - } -} - -/* - Template specializations for PrimitiveDataType - */ -template <> size_t PrimitiveDataType::getSize() const { - std::cerr << "WARNING: Calling PrimitiveDataType::getSize()" - << ", i.e., attempting to get the size of void, indicates that" - << " you may be up to no good and about to run out of luck." << std::endl; - return 0; -} -template <> void PrimitiveDataType::deleteInstance(void* address) const { - std::cerr << "WARNING: Cannot delete the object, of type at address (" - << address << ")." << std::endl; -} -template <> void* PrimitiveDataType::createInstance(unsigned int num) const { - std::cerr << "WARNING: Cannot create an object, of type ." << std::endl; - return NULL; -} -template <> void PrimitiveDataType:: clearValue(void * address) const { - std::cerr << "WARNING: Cannot clear the value of the object, of type at address (" - << address << ")." << std::endl; -} -template <> void PrimitiveDataType:: assignValue(void * address, Value * value) const { - std::cerr << "WARNING: Cannot assign a value to the object, of type at address (" - << address << ")." << std::endl; -} -template <> void PrimitiveDataType::printValue(std::ostream &s, void *address ) const { - std::cerr << "WARNING: Cannot print the value of the object, of type at address (" << address - << " of type void." << std::endl; -} diff --git a/trick_source/sim_services/DataTypes/src/StaticStructMember.cpp b/trick_source/sim_services/DataTypes/src/StaticStructMember.cpp deleted file mode 100644 index e84739b44..000000000 --- a/trick_source/sim_services/DataTypes/src/StaticStructMember.cpp +++ /dev/null @@ -1,144 +0,0 @@ -#include "StaticStructMember.hh" -#include "TypeDictionary.hh" -#include "ArrayDataType.hh" -#include -#include - -// CONSTRUCTOR -StaticStructMember::StaticStructMember(std::string memberName, - void * memberAddress, - TypeDictionary* typeDictionary, - std::string typeSpecName, - unsigned int n_dims, - int dims[] ) : StructMember(memberName) { - - if ( n_dims > 0 ) { - this->typeSpecName.clear(); - declDataType = new ArrayDataType( typeDictionary, typeSpecName, n_dims, dims); - } else { - this->typeSpecName = typeSpecName; - declDataType = NULL; - } - - subType = NULL; - this->memberAddress = memberAddress; - this->typeDictionary = typeDictionary; - is_valid = false; -} - -// CONSTRUCTOR -StaticStructMember::StaticStructMember ( const StaticStructMember & original ) - :StructMember( original ) { - - memberAddress = original.memberAddress; - is_valid = original.is_valid; - typeSpecName = original.typeSpecName; - - if ( original.declDataType != NULL) { - declDataType = original.declDataType->clone(); - } else { - declDataType = NULL; - } - - if (is_valid) { - if (typeSpecName.empty()) { - subType = declDataType; - } else { - subType = original.subType; - } - } -} - -StructMember * StaticStructMember::clone () const { - return new StaticStructMember( *this ); -} - -StaticStructMember::~StaticStructMember() { - if (declDataType != NULL) { - delete declDataType; - } -} - -bool StaticStructMember::validate() { - - if (!is_valid) { - if (typeSpecName.empty()) { - is_valid = declDataType->validate(); - if (is_valid) { - subType = declDataType; - } - } else { - subType = typeDictionary->getDataType( typeSpecName ); - - if (subType != NULL) { - is_valid = true; - } else { - std::cerr << "ERROR: Type \"" << typeSpecName - << "\" not found in the TypeDictionary." << std::endl; - } - } - } - return is_valid; -} - - -// MEMBER FUNCTION -bool StaticStructMember::containsPointers() const { - if (is_valid) { - return subType->containsPointers(); - } - return false; -} - -// MEMBER FUNCTION -const DataType * StaticStructMember::getDataType() { - return subType; -} - -// MEMBER FUNCTION -void* StaticStructMember::getAddress() { - return memberAddress; -} - -// MEMBER FUNCTION -void StaticStructMember::clearValue(void *struct_address) const { - - if (is_valid) { - subType->clearValue( memberAddress); - } else { - std::cerr << "ERROR: Attempt to clear a value via unvalidated DataType." << std::endl; - } -} - -// MEMBER FUNCTION -void StaticStructMember::assignValue(void *struct_address, Value *v ) const { - - if (is_valid) { - subType->assignValue( memberAddress, v); - } else { - std::cerr << "ERROR: Attempt to assign a value via unvalidated DataType." << std::endl; - } -} - -// MEMBER FUNCTION -void StaticStructMember::printValue(std::ostream &s, void *struct_address) const { - - // Note that struct_address is not used. We still need to satisfy the virtual interface. - if (is_valid) { - subType->printValue(s, memberAddress) ; - } else { - std::cerr << "ERROR: Attempt to print a value via unvalidated DataType." << std::endl; - } -} - -// MEMBER FUNCTION -std::string StaticStructMember:: toString() const { - std::ostringstream oss; - oss << "static "; - if (! typeSpecName.empty()) { - oss << typeSpecName << " " << getName(); - } else { - oss << subType->makeDeclaration(getName(), true); - } - return oss.str(); -} diff --git a/trick_source/sim_services/DataTypes/src/StringValue.cpp b/trick_source/sim_services/DataTypes/src/StringValue.cpp deleted file mode 100644 index 27d187d1d..000000000 --- a/trick_source/sim_services/DataTypes/src/StringValue.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "StringValue.hh" - -StringValue::StringValue(const char* value) { - this->value = value; -}; - -void StringValue::print(std::ostream &s) { - s << value; -} - -std::string StringValue::toString() { - return value; -} diff --git a/trick_source/sim_services/DataTypes/src/StructMember.cpp b/trick_source/sim_services/DataTypes/src/StructMember.cpp deleted file mode 100644 index 512c86fc8..000000000 --- a/trick_source/sim_services/DataTypes/src/StructMember.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "StructMember.hh" - -StructMember::StructMember(std::string name) { - this->name = name; -} - -// COPY CONSTRUCTOR -StructMember::StructMember ( const StructMember & original) { - this->name = original.name; -} - -std::string StructMember::getName() const { - return name; -} - diff --git a/trick_source/sim_services/DataTypes/src/TypeDictionary.cpp b/trick_source/sim_services/DataTypes/src/TypeDictionary.cpp deleted file mode 100644 index 6842aabd0..000000000 --- a/trick_source/sim_services/DataTypes/src/TypeDictionary.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "DataType.hh" -#include "TypeDictionary.hh" -#include "PrimitiveDataType.hh" -#include -#include - -// MEMBER FUNCTION -TypeDictionary::TypeDictionary() { - - // Add builtin types. - addTypeDefinition("void", new PrimitiveDataType() ); - addTypeDefinition("char", new PrimitiveDataType() ); - addTypeDefinition("short", new PrimitiveDataType() ); - addTypeDefinition("int", new PrimitiveDataType() ); - addTypeDefinition("long", new PrimitiveDataType() ); - addTypeDefinition("wchar_t", new PrimitiveDataType() ); - addTypeDefinition("long long", new PrimitiveDataType() ); - addTypeDefinition("unsigned char", new PrimitiveDataType() ); - addTypeDefinition("unsigned short", new PrimitiveDataType() ); - addTypeDefinition("unsigned int", new PrimitiveDataType() ); - addTypeDefinition("unsigned long", new PrimitiveDataType() ); - addTypeDefinition("unsigned long long", new PrimitiveDataType() ); - addTypeDefinition("float", new PrimitiveDataType() ); - addTypeDefinition("double", new PrimitiveDataType() ); - // FIXME: add the other goofy types (e.g., uint8 ) that were added via the old lexical analyzer. - -} - -// MEMBER FUNCTION -const DataType* TypeDictionary::getDataType(std::string name ) { - - typeDictionaryIterator = typeDictionary.find(name); - if (typeDictionaryIterator == typeDictionary.end()) { - return NULL; - } else { - return( typeDictionaryIterator->second ); - } -} - -// MEMBER FUNCTION -void TypeDictionary::addTypeDefinition(std::string name, DataType * typeSpec) { - - const DataType* preExistingDataType = getDataType(name); - - if ( preExistingDataType == NULL ) { - typeDictionary[name] = typeSpec; - } else { - std::stringstream error_stream ; - error_stream << "ERROR: Attempt to re-define type \"" << name << "\"" << std::endl; - throw std::logic_error( error_stream.str()); - } -} - -// MEMBER FUNCTION -bool TypeDictionary::validate() { - - is_valid = true; - for ( typeDictionaryIterator = typeDictionary.begin(); - typeDictionaryIterator != typeDictionary.end(); - typeDictionaryIterator++ ) { - - DataType* dataType = typeDictionaryIterator->second; - is_valid = is_valid && dataType->validate(); - } - if (!is_valid) { - std::cerr << "TypeDictionary contains invalidate data-types."; - } - return is_valid; -} - -// MEMBER FUNCTION -std::string TypeDictionary::toString() { - std::ostringstream oss; - - for ( typeDictionaryIterator = typeDictionary.begin(); - typeDictionaryIterator != typeDictionary.end(); - typeDictionaryIterator++ ) { - - oss << typeDictionaryIterator->first << " = " << typeDictionaryIterator->second << std::endl; - } - - return oss.str(); -} - -// MEMBER FUNCTION -TypeDictionary::~TypeDictionary() { - - // Delete all DataTypes in the map. - for ( typeDictionaryIterator = typeDictionary.begin(); - typeDictionaryIterator != typeDictionary.end(); - typeDictionaryIterator++ ) { - - delete typeDictionaryIterator->second; - } -} - - - - - - - - diff --git a/trick_source/sim_services/DataTypes/testing/AllocInfoTest.cpp b/trick_source/sim_services/DataTypes/testing/AllocInfoTest.cpp deleted file mode 100644 index 145d7775b..000000000 --- a/trick_source/sim_services/DataTypes/testing/AllocInfoTest.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#include -#include -#include -#include "AllocInfo.hh" -#include "TypeDictionary.hh" -#include "DataType.hh" - -// Framework -class AllocInfoTest : public ::testing::Test { - protected: - TypeDictionary *typeDictionary; - AllocInfoTest() { typeDictionary = new TypeDictionary; } - ~AllocInfoTest() { delete typeDictionary; } - void SetUp() {} - void TearDown() {} -}; - -/* ================================================================================ - Test Cases - ================================================================================ -*/ -TEST_F(AllocInfoTest, instantiation1) { - - bool construction_result = true; - try { - AllocInfo * allocInfo = new AllocInfo("Apple", "double", 0, NULL, typeDictionary); - std::cout << allocInfo->toString(); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - construction_result = false; - } - EXPECT_EQ(true, construction_result); -} - -TEST_F(AllocInfoTest, instantiation2) { - - bool construction_result = true; - try { - int dimSize[] = {4}; - AllocInfo * allocInfo = new AllocInfo("Apple", "double", 1, dimSize, typeDictionary); - std::cout << allocInfo->toString(); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - construction_result = false; - } - EXPECT_EQ(true, construction_result); -} - - -TEST_F(AllocInfoTest, instantiation3) { - - bool construction_result = true; - try { - int dimSize[] = {7,-1}; - AllocInfo * allocInfo = new AllocInfo("", "double", 2, dimSize, typeDictionary); - std::cout << allocInfo->toString(); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - construction_result = false; - } - EXPECT_EQ(true, construction_result); -} - -TEST_F(AllocInfoTest, getters1) { - - bool construction_result = true; - AllocInfo * allocInfo; - - try { - int dimSize[] = {7,-1}; - allocInfo = new AllocInfo("", "double", 2, dimSize, typeDictionary); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - construction_result = false; - } - ASSERT_EQ(true, construction_result); - EXPECT_EQ("", allocInfo->getName()); - EXPECT_NE((void*)NULL, allocInfo->getStart()); - EXPECT_EQ((size_t)7*sizeof(void*), (size_t)allocInfo->getSize()); - EXPECT_EQ("double", allocInfo->getTypeSpecifierName()); - EXPECT_EQ(2, allocInfo->getDimensionsCount()); - EXPECT_EQ(7, allocInfo->getDimensionSize(0)); - EXPECT_EQ(-1, allocInfo->getDimensionSize(1)); - EXPECT_EQ(StorageClass::LOCAL, allocInfo->getStorageClass()); -} - -TEST_F(AllocInfoTest, getters2) { - - int A[3][7]; - - bool construction_result = true; - AllocInfo * allocInfo; - - try { - int dimSize[] = {3,7}; - allocInfo = new AllocInfo("Orange", "int", 2, dimSize, typeDictionary, A); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - construction_result = false; - } - ASSERT_EQ(true, construction_result); - EXPECT_EQ("Orange", allocInfo->getName()); - EXPECT_EQ((void*)&A, allocInfo->getStart()); - EXPECT_EQ(sizeof(A), (size_t)allocInfo->getSize()); - EXPECT_EQ("int", allocInfo->getTypeSpecifierName()); - EXPECT_EQ(2, allocInfo->getDimensionsCount()); - EXPECT_EQ(3, allocInfo->getDimensionSize(0)); - EXPECT_EQ(7, allocInfo->getDimensionSize(1)); - EXPECT_EQ(StorageClass::EXTERN, allocInfo->getStorageClass()); -} - -TEST_F(AllocInfoTest, clear) { - - double A[3][2] = { {11.0, 12.0}, - {21.0, 22.0}, - {31.0, 32.0} }; - - bool construction_result = true; - AllocInfo * allocInfo; - try { - allocInfo = new AllocInfo( "double Banana[3][2]", typeDictionary, A); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - construction_result = false; - } - - ASSERT_EQ(true, construction_result); - EXPECT_NEAR(11.0, A[0][0], 0.0000001); - EXPECT_NEAR(12.0, A[0][1], 0.0000001); - EXPECT_NEAR(21.0, A[1][0], 0.0000001); - EXPECT_NEAR(22.0, A[1][1], 0.0000001); - EXPECT_NEAR(31.0, A[2][0], 0.0000001); - EXPECT_NEAR(32.0, A[2][1], 0.0000001); - - allocInfo->clear(); - - EXPECT_NEAR(0.0, A[0][0], 0.0000001); - EXPECT_NEAR(0.0, A[0][1], 0.0000001); - EXPECT_NEAR(0.0, A[1][0], 0.0000001); - EXPECT_NEAR(0.0, A[1][1], 0.0000001); - EXPECT_NEAR(0.0, A[2][0], 0.0000001); - EXPECT_NEAR(0.0, A[2][1], 0.0000001); - - EXPECT_EQ(true, construction_result); -} diff --git a/trick_source/sim_services/DataTypes/testing/ArrayTypeSpecTest.cpp b/trick_source/sim_services/DataTypes/testing/ArrayTypeSpecTest.cpp deleted file mode 100644 index 1b6999600..000000000 --- a/trick_source/sim_services/DataTypes/testing/ArrayTypeSpecTest.cpp +++ /dev/null @@ -1,432 +0,0 @@ -#include -#include -#include -#include "TypeDictionary.hh" -#include "ArrayDataType.hh" -#include "CompositeValue.hh" -#include "FloatingPointValue.hh" -#include "IntegerValue.hh" - -// Framework -class ArrayDataTypeTest : public ::testing::Test { - protected: - TypeDictionary *typeDictionary; - ArrayDataTypeTest() { typeDictionary = new TypeDictionary; } - ~ArrayDataTypeTest() { delete typeDictionary; } - void SetUp() {} - void TearDown() {} -}; - -/* ================================================================================ - Test Cases - ================================================================================ -*/ - -TEST_F( ArrayDataTypeTest , constructor_exception ) { - - std::cout << "===== Expecting exception and corresponding message. =====" << std::endl; - - // Attempt to create type an ArrayDataType with 0 dimensions. - // This attempt should throw an exception. - - ArrayDataType * arrayTypeSpec; - bool constructor_result = true; - try { - arrayTypeSpec = new ArrayDataType(typeDictionary, "double", 0, NULL); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - constructor_result = false; - } - - // Verify that an exception was raised. - EXPECT_EQ(false, constructor_result); - - // Clean up. - if (constructor_result) { - delete arrayTypeSpec; - } -} - -TEST_F( ArrayDataTypeTest, copy_constructor ) { - - try { - // Create a ArrayDataType. - int cdims[] = {7,-1,-1}; - ArrayDataType* orig = new ArrayDataType( typeDictionary, "float", 3, cdims); - - std::cout << orig->toString(); - - // Duplicate it. - ArrayDataType* copy = new ArrayDataType( *(const ArrayDataType*)orig ); - - // Delete the original, so we know the copy is independent. - delete orig; - - // Verify that the duplicate ArrayDataType is what we expect. - std::stringstream ss; - ss << copy->toString(); - EXPECT_EQ("float**[7]", ss.str()); - - // Clean up. - delete copy; - - } catch ( std::logic_error e ) { - std::cerr << e.what(); - } - -} - -TEST_F( ArrayDataTypeTest , assignment_operator ) { - - // Create an ArrayDataType. - int cdims[] = {7,-1,-1}; - ArrayDataType * orig = new ArrayDataType( typeDictionary, "long", 3, cdims); - - std::cout << orig->toString(); - - // Assign it to another ArrayDataType. - ArrayDataType copy = *(const ArrayDataType*)orig; - - // Verify that the assigned ArrayDataType is what we expect. - std::stringstream ss; - ss << copy.toString(); - EXPECT_EQ("long**[7]", ss.str()); - - // Clean up. - delete orig; -} - -TEST_F( ArrayDataTypeTest , clone ) { - - // Create a ArrayDataType. - int cdims[] = {3,4,5,-1,-1}; - ArrayDataType* orig = new ArrayDataType(typeDictionary, "int", 5, cdims); - - // Clone it. - DataType * copy = orig->clone(); - - // Delete the original, so we know the copy is independent. - delete orig; - - // Verify that the cloned ArrayDataType is what we expect. - std::stringstream ss; - ss << copy->toString(); - EXPECT_EQ("int**[3][4][5]", ss.str()); - - // Clean up. - delete copy; -} - -TEST_F( ArrayDataTypeTest , getSize ) { - - // Create a PointerDataType. - int cdims[] = {3,4,5,-1,-1}; - ArrayDataType* ptrTypeSpec = new ArrayDataType( typeDictionary, "long", 5, cdims); - ptrTypeSpec->validate(); - - // Verify that getSize returns the size of the array. - EXPECT_EQ( sizeof(long)*60 , ptrTypeSpec->getSize()); -} - -TEST_F( ArrayDataTypeTest , assignValue ) { - - double A[2][3][4]; - - // Create a PointerDataType. - int cdims[] = {2,3,4}; - ArrayDataType * arrayTypeSpec = new ArrayDataType( typeDictionary, "double", 3, cdims); - - arrayTypeSpec->validate(); // TODO: Test behavior when it isnt validated also. - - CompositeValue * value_0_0 = new CompositeValue(); - value_0_0->addMember( new FloatingPointValue(1.2)); - value_0_0->addMember( new FloatingPointValue(2.3)); - value_0_0->addMember( new FloatingPointValue(3.4)); - value_0_0->addMember( new FloatingPointValue(4.5)); - - CompositeValue * value_0_1 = new CompositeValue(); - value_0_1->addMember( new FloatingPointValue(5.6)); - value_0_1->addMember( new FloatingPointValue(6.7)); - value_0_1->addMember( new FloatingPointValue(7.8)); - value_0_1->addMember( new FloatingPointValue(8.9)); - - CompositeValue * value_0_2 = new CompositeValue(); - value_0_2->addMember( new FloatingPointValue(9.0)); - value_0_2->addMember( new FloatingPointValue(0.1)); - value_0_2->addMember( new FloatingPointValue(1.2)); - value_0_2->addMember( new FloatingPointValue(2.3)); - - CompositeValue * value_1_0 = new CompositeValue(); - value_1_0->addMember( new FloatingPointValue(3.4)); - value_1_0->addMember( new FloatingPointValue(4.5)); - value_1_0->addMember( new FloatingPointValue(5.6)); - value_1_0->addMember( new FloatingPointValue(6.7)); - - CompositeValue * value_1_1 = new CompositeValue(); - value_1_1->addMember( new FloatingPointValue(7.8)); - value_1_1->addMember( new FloatingPointValue(8.9)); - value_1_1->addMember( new FloatingPointValue(9.0)); - value_1_1->addMember( new FloatingPointValue(0.1)); - - CompositeValue * value_1_2 = new CompositeValue(); - value_1_2->addMember( new FloatingPointValue(1.2)); - value_1_2->addMember( new FloatingPointValue(2.3)); - value_1_2->addMember( new FloatingPointValue(3.4)); - value_1_2->addMember( new FloatingPointValue(4.5)); - - CompositeValue * value_0 = new CompositeValue(); - value_0->addMember( value_0_0 ); - value_0->addMember( value_0_1 ); - value_0->addMember( value_0_2 ); - - CompositeValue * value_1 = new CompositeValue(); - value_1->addMember( value_1_0 ); - value_1->addMember( value_1_1 ); - value_1->addMember( value_1_2 ); - - CompositeValue * value = new CompositeValue(); - value->addMember( value_0 ); - value->addMember( value_1 ); - - arrayTypeSpec->assignValue(A, value); - - EXPECT_EQ(1.2, A[0][0][0]); - EXPECT_EQ(2.3, A[0][0][1]); - EXPECT_EQ(3.4, A[0][0][2]); - EXPECT_EQ(4.5, A[0][0][3]); - - EXPECT_EQ(5.6, A[0][1][0]); - EXPECT_EQ(6.7, A[0][1][1]); - EXPECT_EQ(7.8, A[0][1][2]); - EXPECT_EQ(8.9, A[0][1][3]); - - EXPECT_EQ(9.0, A[0][2][0]); - EXPECT_EQ(0.1, A[0][2][1]); - EXPECT_EQ(1.2, A[0][2][2]); - EXPECT_EQ(2.3, A[0][2][3]); - - EXPECT_EQ(3.4, A[1][0][0]); - EXPECT_EQ(4.5, A[1][0][1]); - EXPECT_EQ(5.6, A[1][0][2]); - EXPECT_EQ(6.7, A[1][0][3]); - - EXPECT_EQ(7.8, A[1][1][0]); - EXPECT_EQ(8.9, A[1][1][1]); - EXPECT_EQ(9.0, A[1][1][2]); - EXPECT_EQ(0.1, A[1][1][3]); - - EXPECT_EQ(1.2, A[1][2][0]); - EXPECT_EQ(2.3, A[1][2][1]); - EXPECT_EQ(3.4, A[1][2][2]); - EXPECT_EQ(4.5, A[1][2][3]); -} - -TEST_F( ArrayDataTypeTest , createInstance_and_assignValue ) { - - // Create a PointerDataType. - int cdims[] = {2,3,4}; - ArrayDataType * arrayTypeSpec = new ArrayDataType( typeDictionary, "double", 3, cdims); - - arrayTypeSpec->validate(); // TODO: Test behavior when it isnt validated also. - - double (*A)[2][3][4] = (double(*)[2][3][4])arrayTypeSpec->createInstance(1); - - CompositeValue * value_0_0 = new CompositeValue(); - value_0_0->addMember( new FloatingPointValue(1.2)); - value_0_0->addMember( new FloatingPointValue(2.3)); - value_0_0->addMember( new FloatingPointValue(3.4)); - value_0_0->addMember( new FloatingPointValue(4.5)); - - CompositeValue * value_0_1 = new CompositeValue(); - value_0_1->addMember( new FloatingPointValue(5.6)); - value_0_1->addMember( new FloatingPointValue(6.7)); - value_0_1->addMember( new FloatingPointValue(7.8)); - value_0_1->addMember( new FloatingPointValue(8.9)); - - CompositeValue * value_0_2 = new CompositeValue(); - value_0_2->addMember( new FloatingPointValue(9.0)); - value_0_2->addMember( new FloatingPointValue(0.1)); - value_0_2->addMember( new FloatingPointValue(1.2)); - value_0_2->addMember( new FloatingPointValue(2.3)); - - CompositeValue * value_1_0 = new CompositeValue(); - value_1_0->addMember( new FloatingPointValue(3.4)); - value_1_0->addMember( new FloatingPointValue(4.5)); - value_1_0->addMember( new FloatingPointValue(5.6)); - value_1_0->addMember( new FloatingPointValue(6.7)); - - CompositeValue * value_1_1 = new CompositeValue(); - value_1_1->addMember( new FloatingPointValue(7.8)); - value_1_1->addMember( new FloatingPointValue(8.9)); - value_1_1->addMember( new FloatingPointValue(9.0)); - value_1_1->addMember( new FloatingPointValue(0.1)); - - CompositeValue * value_1_2 = new CompositeValue(); - value_1_2->addMember( new FloatingPointValue(1.2)); - value_1_2->addMember( new FloatingPointValue(2.3)); - value_1_2->addMember( new FloatingPointValue(3.4)); - value_1_2->addMember( new FloatingPointValue(4.5)); - - CompositeValue * value_0 = new CompositeValue(); - value_0->addMember( value_0_0 ); - value_0->addMember( value_0_1 ); - value_0->addMember( value_0_2 ); - - CompositeValue * value_1 = new CompositeValue(); - value_1->addMember( value_1_0 ); - value_1->addMember( value_1_1 ); - value_1->addMember( value_1_2 ); - - CompositeValue * value = new CompositeValue(); - value->addMember( value_0 ); - value->addMember( value_1 ); - - arrayTypeSpec->assignValue(A, value); - - EXPECT_EQ(1.2, (*A)[0][0][0]); - EXPECT_EQ(2.3, (*A)[0][0][1]); - EXPECT_EQ(3.4, (*A)[0][0][2]); - EXPECT_EQ(4.5, (*A)[0][0][3]); - - EXPECT_EQ(5.6, (*A)[0][1][0]); - EXPECT_EQ(6.7, (*A)[0][1][1]); - EXPECT_EQ(7.8, (*A)[0][1][2]); - EXPECT_EQ(8.9, (*A)[0][1][3]); - - EXPECT_EQ(9.0, (*A)[0][2][0]); - EXPECT_EQ(0.1, (*A)[0][2][1]); - EXPECT_EQ(1.2, (*A)[0][2][2]); - EXPECT_EQ(2.3, (*A)[0][2][3]); - - EXPECT_EQ(3.4, (*A)[1][0][0]); - EXPECT_EQ(4.5, (*A)[1][0][1]); - EXPECT_EQ(5.6, (*A)[1][0][2]); - EXPECT_EQ(6.7, (*A)[1][0][3]); - - EXPECT_EQ(7.8, (*A)[1][1][0]); - EXPECT_EQ(8.9, (*A)[1][1][1]); - EXPECT_EQ(9.0, (*A)[1][1][2]); - EXPECT_EQ(0.1, (*A)[1][1][3]); - - EXPECT_EQ(1.2, (*A)[1][2][0]); - EXPECT_EQ(2.3, (*A)[1][2][1]); - EXPECT_EQ(3.4, (*A)[1][2][2]); - EXPECT_EQ(4.5, (*A)[1][2][3]); -} - -TEST_F( ArrayDataTypeTest, printValue ) { - - double A[2][3][4] = {{{1.2, 2.3, 3.4, 4.5}, - {5.6, 6.7, 7.8, 8.9}, - {9.0, 0.1, 1.2, 2.3}}, - {{3.4, 4.5, 5.6, 6.7}, - {7.8, 8.9, 9.0, 0.1}, - {1.2, 2.3, 3.4, 4.5}}}; - - // Create a ArrayDataType. - int cdims[] = {2,3,4}; - ArrayDataType * arrayTypeSpec = new ArrayDataType( typeDictionary, "double", 3, cdims); - - arrayTypeSpec->validate(); - - // Verify that printValue prints the value that we expect. - std::stringstream ss; - arrayTypeSpec->printValue(ss, &A); - int result = ss.str().compare( - "{{{1.2,2.3,3.4,4.5}," - "{5.6,6.7,7.8,8.9}," - "{9,0.1,1.2,2.3}}," - "{{3.4,4.5,5.6,6.7}," - "{7.8,8.9,9,0.1}," - "{1.2,2.3,3.4,4.5}}}" - ); - - EXPECT_EQ(0, result); -} - -TEST_F( ArrayDataTypeTest, validate_1 ) { - - // Create a ArrayDataType. - int cdims[] = {4}; - ArrayDataType* arrayTypeSpec = new ArrayDataType( typeDictionary, "double", 1, cdims); - - // Validate the Type. - bool validation_result = arrayTypeSpec->validate(); - - // Verify that validation succeeded. - ASSERT_EQ(true, validation_result); - -} - -TEST_F( ArrayDataTypeTest , validate_2 ) { - - std::cout << "===== Expecting error message. =====" << std::endl; - - // Create an ArrayDataType. - int cdims[] = {4}; - ArrayDataType* arrayTypeSpec = new ArrayDataType( typeDictionary, "Undefined_Type", 1, cdims); - - // Validate the Type. - bool validation_result = arrayTypeSpec->validate(); - - // Verify that validation failed. - ASSERT_EQ(false, validation_result); -} - -TEST_F( ArrayDataTypeTest , getSubType_1 ) { - - // Create type: double [2][3] - ArrayDataType * arrayTypeSpec; - bool constructor_result = true; - try { - int cdims[] = {2,3}; - arrayTypeSpec = new ArrayDataType( typeDictionary, "double", 2, cdims); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - constructor_result = false; - } - ASSERT_EQ(true, constructor_result); - - // Validate the Type. - bool validation_result = arrayTypeSpec->validate(); - ASSERT_EQ(true, validation_result); - - // Get the subType. - const DataType * elementTypeSpec; - elementTypeSpec = arrayTypeSpec->getSubType(); - ASSERT_NE((const DataType *)NULL, elementTypeSpec); - - // Make sure it's: double[3]. - std::stringstream ss; - ss << elementTypeSpec->toString(); - EXPECT_EQ("double [3]", ss.str()); -} - -TEST_F( ArrayDataTypeTest , getSubType_2 ) { - - // Create type: double[2] - ArrayDataType * arrayTypeSpec; - bool constructor_result = true; - try { - int cdims[] = {2}; - arrayTypeSpec = new ArrayDataType( typeDictionary, "double", 1, cdims); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - constructor_result = false; - } - ASSERT_EQ(true, constructor_result); - - // Validate the Type. - bool validation_result = arrayTypeSpec->validate(); - ASSERT_EQ(true, validation_result); - - // Get the SubType. - const DataType * elementTypeSpec; - elementTypeSpec = arrayTypeSpec->getSubType(); - ASSERT_NE((const DataType *)NULL, elementTypeSpec); - - // Make sure it's: double - std::stringstream ss; - ss << elementTypeSpec->toString(); - EXPECT_EQ("double", ss.str()); -} diff --git a/trick_source/sim_services/DataTypes/testing/ClassicChkPtAgentTest.cpp b/trick_source/sim_services/DataTypes/testing/ClassicChkPtAgentTest.cpp deleted file mode 100644 index ecbcb82e1..000000000 --- a/trick_source/sim_services/DataTypes/testing/ClassicChkPtAgentTest.cpp +++ /dev/null @@ -1,387 +0,0 @@ -#include -#include -#include - -#include "MemMgr.hh" -#include "AllocInfo.hh" -#include "DataType.hh" -#include "ClassicChkPtAgent.hh" -#include "TypeDictionary.hh" -#include "EnumDictionary.hh" -#include "CompositeDataType.hh" -#include "ArrayDataType.hh" -#include "PointerDataType.hh" - -#include "DataTypeTestSupport.hh" - -// Framework -class ClassicChkPtAgentTest : public ::testing::Test { - protected: - TypeDictionary * typeDictionary; - EnumDictionary * enumDictionary; - ClassicChkPtAgent* checkPointAgent; - MemMgr * memMgr; - - ClassicChkPtAgentTest() { - typeDictionary = new TypeDictionary; - enumDictionary = new EnumDictionary; - memMgr = new MemMgr(); - checkPointAgent = new ClassicChkPtAgent( std::cout ); - } - - ~ClassicChkPtAgentTest() { - delete memMgr ; - delete typeDictionary ; - delete enumDictionary ; - } - void SetUp() {} - void TearDown() {} -}; - -/* ================================================================================ - Test Cases - ================================================================================ -*/ -TEST_F(ClassicChkPtAgentTest, nameStackFunctions) { - - std::string leftSideName; - - checkPointAgent->pushName("A"); - leftSideName = checkPointAgent->getLeftSideName(); - EXPECT_EQ("A", leftSideName); - - checkPointAgent->pushIndex(2); - leftSideName = checkPointAgent->getLeftSideName(); - EXPECT_EQ("A[2]", leftSideName); - - checkPointAgent->pushName("B"); - leftSideName = checkPointAgent->getLeftSideName(); - EXPECT_EQ("A[2].B", leftSideName); - - checkPointAgent->pushIndex(3); - leftSideName = checkPointAgent->getLeftSideName(); - EXPECT_EQ("A[2].B[3]", leftSideName); - - checkPointAgent->popNameElement(); - leftSideName = checkPointAgent->getLeftSideName(); - EXPECT_EQ("A[2].B", leftSideName); - - checkPointAgent->popNameElement(); - leftSideName = checkPointAgent->getLeftSideName(); - EXPECT_EQ("A[2]", leftSideName); - - checkPointAgent->popNameElement(); - leftSideName = checkPointAgent->getLeftSideName(); - EXPECT_EQ("A", leftSideName); - - checkPointAgent->popNameElement(); - leftSideName = checkPointAgent->getLeftSideName(); - EXPECT_EQ("", leftSideName); - - std::cout << "NOTE: A Warning is expected here." << std::endl; - checkPointAgent->popNameElement(); - leftSideName = checkPointAgent->getLeftSideName(); - EXPECT_EQ("", leftSideName); - -} - -// ================================================================================ -// writeDeclaration tests -// ================================================================================ - -TEST_F(ClassicChkPtAgentTest, writeDeclaration1) { - - // A is an int. - std::stringstream output_declaration; - bool construction_result = true; - AllocInfo * allocInfo; - try { - allocInfo = new AllocInfo("A", "int", 0, NULL, typeDictionary); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - construction_result = false; - } - ASSERT_EQ(true, construction_result); - checkPointAgent->writeDeclaration( output_declaration, allocInfo->getName(), allocInfo->getDataType()); - delete allocInfo; - EXPECT_EQ("int A;\n", output_declaration.str()); -} - -TEST_F(ClassicChkPtAgentTest, writeDeclaration2) { - - // A is a pointer to int. - std::stringstream output_declaration; - bool construction_result = true; - AllocInfo * allocInfo; - try { - int dimSize[] = {-1}; - allocInfo = new AllocInfo("A", "int", 1, dimSize, typeDictionary); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - construction_result = false; - } - ASSERT_EQ(true, construction_result); - checkPointAgent->writeDeclaration( output_declaration, allocInfo->getName(), allocInfo->getDataType()); - delete allocInfo; - EXPECT_EQ("int *A;\n", output_declaration.str()); -} - -TEST_F(ClassicChkPtAgentTest, writeDeclaration3) { - - // A is an array of pointers to int. - std::stringstream output_declaration; - bool construction_result = true; - AllocInfo * allocInfo; - try { - int dimSize[] = {3,-1}; - allocInfo = new AllocInfo("A", "int", 2, dimSize, typeDictionary); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - construction_result = false; - } - ASSERT_EQ(true, construction_result); - checkPointAgent->writeDeclaration( output_declaration, allocInfo->getName(), allocInfo->getDataType()); - delete allocInfo; - EXPECT_EQ("int *A[3];\n", output_declaration.str()); -} - -TEST_F(ClassicChkPtAgentTest, writeDeclaration4) { - - // A is a pointer to a 3 element array of int. - std::stringstream output_declaration; - bool construction_result = true; - AllocInfo * allocInfo; - try { - int dimSize[] = {-1,3}; - allocInfo = new AllocInfo("A", "int", 2, dimSize, typeDictionary); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - construction_result = false; - } - ASSERT_EQ(true, construction_result); - checkPointAgent->writeDeclaration( output_declaration, allocInfo->getName(), allocInfo->getDataType()); - delete allocInfo; - EXPECT_EQ("int (*A)[3];\n", output_declaration.str()); -} - -TEST_F(ClassicChkPtAgentTest, writeDeclaration5) { - - // A is a 3 element array of 4 element arrays of pointers to 5 element arrays of pointers to double. - std::stringstream output_declaration; - bool construction_result = true; - AllocInfo * allocInfo; - try { - int dimSize[] = {3,4,-1,5,-1}; - allocInfo = new AllocInfo("A", "int", 5, dimSize, typeDictionary); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - construction_result = false; - } - ASSERT_EQ(true, construction_result); - checkPointAgent->writeDeclaration( output_declaration, allocInfo->getName(), allocInfo->getDataType()); - delete allocInfo; - EXPECT_EQ("int *(*A[3][4])[5];\n", output_declaration.str()); -} - -TEST_F(ClassicChkPtAgentTest, writeDeclaration_DayOfWeekEnum) { - - std::stringstream output_declaration; - bool construction_result = true; - bool result = addDayOfWeekEnumToTypeDictionary( typeDictionary, enumDictionary ); - EXPECT_EQ(true, result); - AllocInfo * allocInfo; - try { - allocInfo = new AllocInfo("A", "DayOfWeek", 0, NULL, typeDictionary); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - construction_result = false; - } - ASSERT_EQ(true, construction_result); - checkPointAgent->writeDeclaration( output_declaration, allocInfo->getName(), allocInfo->getDataType()); - delete allocInfo; - EXPECT_EQ("DayOfWeek A;\n", output_declaration.str()); -} - -// ================================================================================ -// writeAssignment tests -// ================================================================================ - -TEST_F(ClassicChkPtAgentTest, writeAssignment) { - std::stringstream AssignmentStatement; - checkPointAgent->pushName("X"); - checkPointAgent->pushName("Y"); - checkPointAgent->pushIndex(4); - checkPointAgent->writeAssignment( AssignmentStatement, "3.14"); - EXPECT_EQ("X.Y[4] = 3.14;", AssignmentStatement.str()); -} - -// ================================================================================ -// getSubName tests -// ================================================================================ - -TEST_F(ClassicChkPtAgentTest, getSubName1) { - - bool result = addClassOneToTypeDictionary( typeDictionary ); - EXPECT_EQ(true, result); - - const DataType* classOneDataType = typeDictionary->getDataType("ClassOne"); - const DataType* intDataType = typeDictionary->getDataType("int"); - const DataType* doubleDataType = typeDictionary->getDataType("double"); - - ClassOne* classOneVariable = (ClassOne*)classOneDataType->createInstance(1); - - std::stringstream nameStream1; - - checkPointAgent->getSubName( nameStream1, &(classOneVariable->a), intDataType, classOneVariable, classOneDataType); - EXPECT_EQ(".a", nameStream1.str()); - - std::stringstream nameStream2; - checkPointAgent->getSubName( nameStream2, &(classOneVariable->b), doubleDataType, classOneVariable, classOneDataType); - EXPECT_EQ(".b", nameStream2.str()); -} - -TEST_F(ClassicChkPtAgentTest, getSubName2) { - - bool result = false; - - result = addClassOneToTypeDictionary( typeDictionary ); - EXPECT_EQ(true, result); - - result = addClassTwoToTypeDictionary( typeDictionary ); - EXPECT_EQ(true, result); - - const DataType* classOneDataType = typeDictionary->getDataType("ClassOne"); - const DataType* classTwoDataType = typeDictionary->getDataType("ClassTwo"); - const DataType* intDataType = typeDictionary->getDataType("int"); - const DataType* doubleDataType = typeDictionary->getDataType("double"); - - ClassTwo* classTwoVariable = (ClassTwo*)classTwoDataType->createInstance(1); - - std::stringstream nameStream1; - checkPointAgent->getSubName( nameStream1, &(classTwoVariable->x), intDataType, classTwoVariable, classTwoDataType); - EXPECT_EQ(".x", nameStream1.str()); - - std::stringstream nameStream2; - checkPointAgent->getSubName( nameStream2, &(classTwoVariable->y), doubleDataType, classTwoVariable, classTwoDataType); - EXPECT_EQ(".y", nameStream2.str()); - - std::stringstream nameStream3; - checkPointAgent->getSubName( nameStream3, &(classTwoVariable->c1), classOneDataType, classTwoVariable, classTwoDataType); - EXPECT_EQ(".c1", nameStream3.str()); - - std::stringstream nameStream4; - checkPointAgent->getSubName( nameStream4, &(classTwoVariable->c1.a), intDataType, classTwoVariable, classTwoDataType); - EXPECT_EQ(".c1.a", nameStream4.str()); - - std::stringstream nameStream5; - checkPointAgent->getSubName( nameStream5, &(classTwoVariable->c1.b), doubleDataType, classTwoVariable, classTwoDataType); - EXPECT_EQ(".c1.b", nameStream5.str()); -} - -TEST_F(ClassicChkPtAgentTest, getSubName3) { - - bool result = addClassThreeToTypeDictionary( typeDictionary ); - EXPECT_EQ(true, result); - - const DataType* classThreeDataType = typeDictionary->getDataType("ClassThree"); - const DataType* doubleDataType = typeDictionary->getDataType("double"); - - ClassThree* classThreeVariable = (ClassThree*)classThreeDataType->createInstance(1); - - std::stringstream nameStream1; - checkPointAgent->getSubName( nameStream1, &(classThreeVariable->pos[0]), doubleDataType, classThreeVariable, classThreeDataType); - EXPECT_EQ(".pos[0]", nameStream1.str()); - - std::stringstream nameStream2; - checkPointAgent->getSubName( nameStream2, &(classThreeVariable->pos[1]), doubleDataType, classThreeVariable, classThreeDataType); - EXPECT_EQ(".pos[1]", nameStream2.str()); - - std::stringstream nameStream3; - checkPointAgent->getSubName( nameStream3, &(classThreeVariable->vel[0]), doubleDataType, classThreeVariable, classThreeDataType); - EXPECT_EQ(".vel[0]", nameStream3.str()); - - std::stringstream nameStream4; - checkPointAgent->getSubName( nameStream4, &(classThreeVariable->vel[1]), doubleDataType, classThreeVariable, classThreeDataType); - EXPECT_EQ(".vel[1]", nameStream4.str()); -} - -TEST_F(ClassicChkPtAgentTest, writXXXXXXXation1) { - - // A is an int. - std::stringstream output_declaration; - bool construction_result = true; - AllocInfo * allocInfo; - try { - allocInfo = new AllocInfo("A", "int", 0, NULL, typeDictionary); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - construction_result = false; - } - ASSERT_EQ(true, construction_result); - checkPointAgent->writeDeclaration( output_declaration, allocInfo->getName(), allocInfo->getDataType()); - delete allocInfo; - EXPECT_EQ("int A;\n", output_declaration.str()); -} - -TEST_F(ClassicChkPtAgentTest, writeVariable1) { - - bool result = addClassOneToTypeDictionary( typeDictionary ); - EXPECT_EQ(true, result); - - bool construction_result = true; - AllocInfo * allocInfo; - try { - allocInfo = new AllocInfo("A", "ClassOne", 0, NULL, typeDictionary); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - construction_result = false; - } - ASSERT_EQ(true, construction_result); - - ClassOne* classOneVariable = (ClassOne*)allocInfo->getStart(); - const DataType* classOneDataType = allocInfo->getDataType(); - - classOneVariable->a = 4; - classOneVariable->b = 7.1; - - checkPointAgent->writeDeclaration( std::cout, allocInfo->getName(), allocInfo->getDataType()); - checkPointAgent->writeVariable( std::cout, memMgr, classOneVariable, classOneDataType); -} - -TEST_F(ClassicChkPtAgentTest, writeVariable2) { - - bool result; - result = addClassOneToTypeDictionary( typeDictionary ); - EXPECT_EQ(true, result); - - result = addClassTwoToTypeDictionary( typeDictionary ); - EXPECT_EQ(true, result); - - const DataType* classTwoDataType = typeDictionary->getDataType("ClassTwo"); - - ClassTwo* classTwoVariable = (ClassTwo*)classTwoDataType->createInstance(1); - classTwoVariable->x = 2; - classTwoVariable->y = 8.7; - classTwoVariable->c1.a = 9; - classTwoVariable->c1.b = 18.4; - - checkPointAgent->writeVariable( std::cout, memMgr, classTwoVariable, classTwoDataType); -} - -TEST_F(ClassicChkPtAgentTest, writeVariable3) { - - bool result; - result = addClassThreeToTypeDictionary( typeDictionary ); - EXPECT_EQ(true, result); - - const DataType* classThreeDataType = typeDictionary->getDataType("ClassThree"); - - ClassThree* classThreeVariable = (ClassThree*)classThreeDataType->createInstance(1); - classThreeVariable->pos[0] = 2.3; - classThreeVariable->pos[1] = 3.4; - classThreeVariable->vel[0] = 4.5; - classThreeVariable->vel[1] = 5.6; - - checkPointAgent->setMakeCompactArrays(true); - checkPointAgent->writeVariable( std::cout, memMgr, classThreeVariable, classThreeDataType); -} diff --git a/trick_source/sim_services/DataTypes/testing/CompTypeSpecTest.cpp b/trick_source/sim_services/DataTypes/testing/CompTypeSpecTest.cpp deleted file mode 100644 index 82a2dfdc6..000000000 --- a/trick_source/sim_services/DataTypes/testing/CompTypeSpecTest.cpp +++ /dev/null @@ -1,326 +0,0 @@ - -#include -#include -#include "TypeDictionary.hh" -#include "CompositeDataType.hh" -#include "CompositeValue.hh" -#include "PrimitiveDataType.hh" -#include "DataTypeTestSupport.hh" - -// Framework -class CompositeDataTypeTest : public ::testing::Test { - protected: - TypeDictionary *typeDictionary; - CompositeDataTypeTest() { typeDictionary = new TypeDictionary; } - ~CompositeDataTypeTest() { delete typeDictionary; } - void SetUp() {} - void TearDown() {} -}; - -TEST_F(CompositeDataTypeTest, validate ) { - - /* Requirement: CompositeDataType::validate() method shall attempt to resolve - all of it's prerequisite type names to actual DataTypes. If it succeeds, - it shall return true, otherwise it shall return false. */ - - bool test_result; - - // Create a CompositeDataType. - /* Note that this DataType is dependent on the types "int" and "double". Both - both of these named type dependencies must be resolvable, via the TypeDictionary, - to their respective DataTypes. */ - - test_result = addClassOneToTypeDictionary( typeDictionary ); - EXPECT_EQ(true, test_result); - - test_result = addClassTwoToTypeDictionary( typeDictionary ); - EXPECT_EQ(true, test_result); - - test_result = addClassThreeToTypeDictionary( typeDictionary ); - EXPECT_EQ(true, test_result); - - test_result = addClassFourToTypeDictionary( typeDictionary ); - EXPECT_EQ(true, test_result); - - test_result = addClassFiveToTypeDictionary( typeDictionary ); - EXPECT_EQ(true, test_result); - -} - -TEST_F(CompositeDataTypeTest, toString_1 ) { - - EXPECT_EQ(true, addClassOneToTypeDictionary( typeDictionary )); - - const DataType* dataType = typeDictionary->getDataType("ClassOne"); - - ASSERT_TRUE(dataType != NULL) ; - - // Print the duplicate CompositeDataType. - std::string s; - s = dataType->toString(); - - // Check the results. - EXPECT_EQ("composite {\nint a;\ndouble b;\n}\n", s); -} - -TEST_F(CompositeDataTypeTest, toString_2 ) { - - EXPECT_EQ(true, addClassOneToTypeDictionary( typeDictionary )); - EXPECT_EQ(true, addClassTwoToTypeDictionary( typeDictionary )); - - const DataType* dataType = typeDictionary->getDataType("ClassTwo"); - ASSERT_TRUE(dataType != NULL) ; - - // Print the duplicate CompositeDataType. - std::stringstream ss; - ss << dataType->toString(); - - // Check the results. - EXPECT_EQ("composite {\nint x;\ndouble y;\nClassOne c1;\n}\n", ss.str()); -} - -TEST_F(CompositeDataTypeTest, toString_3 ) { - - EXPECT_EQ(true, addClassThreeToTypeDictionary( typeDictionary )); - - const DataType* dataType = typeDictionary->getDataType("ClassThree"); - ASSERT_TRUE(dataType != NULL) ; - - // Print the duplicate CompositeDataType. - std::stringstream ss; - ss << dataType->toString(); - - // Check the results. - EXPECT_EQ("composite {\ndouble pos[2];\ndouble vel[2];\n}\n", ss.str()); -} - -TEST_F(CompositeDataTypeTest, copy_constructor ) { - - EXPECT_EQ(true, addClassOneToTypeDictionary( typeDictionary )); - - const DataType* dataType = typeDictionary->getDataType("ClassOne"); - ASSERT_TRUE(dataType != NULL) ; - - const DataType * copy = new CompositeDataType(*(const CompositeDataType*)dataType); - - // Print the duplicate CompositeDataType. - std::stringstream ss; - ss << copy->toString(); - - // Check the results. - EXPECT_EQ("composite {\nint a;\ndouble b;\n}\n", ss.str()); - - delete copy; -} - -TEST_F(CompositeDataTypeTest, operator_equal ) { - - EXPECT_EQ(true, addClassOneToTypeDictionary( typeDictionary )); - - const DataType* dataType = typeDictionary->getDataType("ClassOne"); - ASSERT_TRUE(dataType != NULL) ; - - CompositeDataType copy = *(const CompositeDataType*)dataType; - - // Print the duplicate CompositeDataType. - std::stringstream ss; - ss << copy.toString(); - - // Check the results. - EXPECT_EQ("composite {\nint a;\ndouble b;\n}\n", ss.str()); -} - - -TEST_F(CompositeDataTypeTest, getSize ) { - - /* Requirement: CompositeDataType::getSize() shall return the size passed in - via the constructor. */ - - CompositeDataType * compTypeSpec = new CompositeDataType( typeDictionary, - "ClassOne", - sizeof(ClassOne), - &construct, - &destruct); - - compTypeSpec->addRegularMember( "a", offsetof(ClassOne, a), "int", 0, NULL); - compTypeSpec->addRegularMember( "b", offsetof(ClassOne, b), "double", 0, NULL); - - EXPECT_EQ( sizeof(ClassOne), compTypeSpec->getSize()); - -} - -TEST_F(CompositeDataTypeTest, assignValue_1) { - - /* Requirement: */ - - ClassOne classOne; - classOne.a = 0; - classOne.b = 0.0; - - EXPECT_EQ(true, addClassOneToTypeDictionary( typeDictionary )); - - const DataType* dataType = typeDictionary->getDataType("ClassOne"); - ASSERT_TRUE(dataType != NULL) ; - - CompositeValue * - classOneValue = new CompositeValue(); - classOneValue->addMember( new IntegerValue(172)); - classOneValue->addMember( new FloatingPointValue(3.1415927)); - - dataType->assignValue(&classOne, classOneValue); - - EXPECT_EQ( 172, classOne.a); - EXPECT_NEAR( 3.1415927, classOne.b, 0.0001); -} - -TEST_F(CompositeDataTypeTest, assignValue_2) { - - /* Requirment: */ - ClassTwo classTwo; - classTwo.x = 0; - classTwo.y = 0.0; - classTwo.c1.a = 0; - classTwo.c1.b = 0.0; - - EXPECT_EQ(true, addClassOneToTypeDictionary( typeDictionary )); - EXPECT_EQ(true, addClassTwoToTypeDictionary( typeDictionary )); - - const DataType* dataType = typeDictionary->getDataType("ClassTwo"); - ASSERT_TRUE(dataType != NULL) ; - - CompositeValue * classOneValue = new CompositeValue(); - classOneValue->addMember( new IntegerValue(172)); - classOneValue->addMember( new FloatingPointValue(3.1415927)); - - CompositeValue * classTwoValue = new CompositeValue(); - classTwoValue->addMember( new IntegerValue(278)); - classTwoValue->addMember( new FloatingPointValue(2.7182818)); - classTwoValue->addMember( classOneValue ); - - dataType->assignValue(&classTwo, classTwoValue); - - delete classTwoValue; - - EXPECT_EQ( 172, classTwo.c1.a); - EXPECT_NEAR( 3.1415927, classTwo.c1.b, 0.0001); - EXPECT_EQ( 278, classTwo.x); - EXPECT_NEAR( 2.7182818, classTwo.y, 0.0001); -} - -TEST_F(CompositeDataTypeTest, assignValue_3) { - - /* Requirment: */ - ClassThree classThree; - classThree.pos[0] = 0.0; - classThree.pos[1] = 0.0; - classThree.vel[0] = 0.0; - classThree.vel[1] = 0.0; - - EXPECT_EQ(true, addClassThreeToTypeDictionary( typeDictionary )); - - const DataType* dataType = typeDictionary->getDataType("ClassThree"); - ASSERT_TRUE(dataType != NULL) ; - - CompositeValue * posValue = new CompositeValue(); - posValue->addMember( new FloatingPointValue(2.3)); - posValue->addMember( new FloatingPointValue(5.7)); - CompositeValue * velValue = new CompositeValue(); - velValue->addMember( new FloatingPointValue(4.3)); - velValue->addMember( new FloatingPointValue(7.7)); - CompositeValue * classThreeValue = new CompositeValue(); - classThreeValue->addMember( posValue ); - classThreeValue->addMember( velValue ); - - dataType->assignValue(&classThree, classThreeValue); - - EXPECT_NEAR( 2.3, classThree.pos[0], 0.0001); - EXPECT_NEAR( 5.7, classThree.pos[1], 0.0001); - EXPECT_NEAR( 4.3, classThree.vel[0], 0.0001); - EXPECT_NEAR( 7.7, classThree.vel[1], 0.0001); - -} - -TEST_F(CompositeDataTypeTest, assignValue_4) { - - /* Requirement: */ - ClassFour classFour; - classFour.x[0] = 0.0; - classFour.x[1] = 0.0; - classFour.f1 = 0; - classFour.f2 = 0; - classFour.f3 = 0; - - EXPECT_EQ(true, addClassFourToTypeDictionary( typeDictionary )); - - const DataType* dataType = typeDictionary->getDataType("ClassFour"); - ASSERT_TRUE(dataType != NULL) ; - - CompositeValue * xValue = new CompositeValue(); - xValue->addMember( new FloatingPointValue(2.3)); - xValue->addMember( new FloatingPointValue(5.7)); - IntegerValue * f1Value = new IntegerValue(2); - IntegerValue * f2Value = new IntegerValue(13); - IntegerValue * f3Value = new IntegerValue(55); - - CompositeValue * classFourValue = new CompositeValue(); - classFourValue->addMember( xValue ); - classFourValue->addMember( f1Value ); - classFourValue->addMember( f2Value ); - classFourValue->addMember( f3Value ); - - dataType->assignValue(&classFour, classFourValue); - - EXPECT_NEAR( 2.3, classFour.x[0], 0.0001); - EXPECT_NEAR( 5.7, classFour.x[1], 0.0001); - EXPECT_EQ( 2, classFour.f1); - EXPECT_EQ( 13, classFour.f2); - EXPECT_EQ( 55, classFour.f3); - -} - -TEST_F(CompositeDataTypeTest, assignValue_5) { - - EXPECT_EQ(true, addClassFiveToTypeDictionary( typeDictionary )); - - const DataType* dataType = typeDictionary->getDataType("ClassFive"); - ASSERT_TRUE(dataType != NULL) ; - - ClassFive* classFive = (ClassFive*)dataType->createInstance(1); - - CompositeValue * classFiveValue = new CompositeValue(); - classFiveValue->addMember( new FloatingPointValue(7.3)); - classFiveValue->addMember( new IntegerValue(13)); - - dataType->assignValue(classFive, classFiveValue); - - EXPECT_NEAR( 7.3, classFive->x, 0.0001); - EXPECT_EQ( 13, classFive->count); -} - - -TEST_F(CompositeDataTypeTest, printValue_4) { - - /* Requirment: */ - - ClassFour classFour; - classFour.x[0] = 0.0; - classFour.x[1] = 0.0; - classFour.f1 = 1; - classFour.f2 = 13; - classFour.f3 = 55; - - EXPECT_EQ(true, addClassFourToTypeDictionary( typeDictionary )); - - const DataType* dataType = typeDictionary->getDataType("ClassFour"); - ASSERT_TRUE(dataType != NULL) ; - - // Print the duplicate CompositeDataType. - std::stringstream ss; - dataType->printValue(ss, &classFour); - - // Check the results. - int result = ss.str().compare("{{0,0}, 1, 13, 55}"); - EXPECT_EQ(0, result); - -} - diff --git a/trick_source/sim_services/DataTypes/testing/DataTypeTestSupport.cpp b/trick_source/sim_services/DataTypes/testing/DataTypeTestSupport.cpp deleted file mode 100644 index 72307854a..000000000 --- a/trick_source/sim_services/DataTypes/testing/DataTypeTestSupport.cpp +++ /dev/null @@ -1,139 +0,0 @@ -#include "DataTypeTestSupport.hh" -#include "CompositeDataType.hh" -#include "CompositeValue.hh" -#include "PrimitiveDataType.hh" -#include "EnumDataType.hh" - -int ClassFive::count = 0; - -static short get_ClassFour__f1(void* addr) { return ((ClassFour*)addr)->f1; } -static void set_ClassFour__f1(void* addr, short v) { ((ClassFour*)addr)->f1 = v; } - -static short get_ClassFour__f2(void* addr) { return ((ClassFour*)addr)->f2; } -static void set_ClassFour__f2(void* addr, short v) { ((ClassFour*)addr)->f2 = v; } - -static short get_ClassFour__f3(void* addr) { return ((ClassFour*)addr)->f3; } -static void set_ClassFour__f3(void* addr, short v) { ((ClassFour*)addr)->f3 = v; } - - -bool addClassOneToTypeDictionary(TypeDictionary* typeDictionary) { - - bool result = false; - try { - CompositeDataType* classOneTypeSpec = - new CompositeDataType(typeDictionary, "ClassOne", sizeof(ClassOne), &construct, &destruct ); - classOneTypeSpec->addRegularMember( "a", offsetof(ClassOne, a), "int", 0, NULL); - classOneTypeSpec->addRegularMember( "b", offsetof(ClassOne, b), "double", 0, NULL); - - typeDictionary->addTypeDefinition("ClassOne", classOneTypeSpec); - result = classOneTypeSpec->validate(); - } catch( std::logic_error e ) { - std::cerr << e.what(); - result = false; - } - return result; -} - -bool addClassTwoToTypeDictionary(TypeDictionary* typeDictionary) { - - bool result = false; - try { - CompositeDataType * classTwoTypeSpec = - new CompositeDataType(typeDictionary, "ClassTwo", sizeof(ClassTwo), &construct, &destruct); - classTwoTypeSpec->addRegularMember( "x", offsetof(ClassTwo, x), "int", 0, NULL); - classTwoTypeSpec->addRegularMember( "y", offsetof(ClassTwo, y), "double", 0, NULL); - classTwoTypeSpec->addRegularMember( "c1", offsetof(ClassTwo, c1), "ClassOne", 0, NULL); - - typeDictionary->addTypeDefinition("ClassTwo", classTwoTypeSpec); - - result = classTwoTypeSpec->validate(); - } catch( std::logic_error e ) { - std::cerr << e.what(); - result = false; - } - return result; -} - -bool addClassThreeToTypeDictionary(TypeDictionary* typeDictionary) { - - bool result = false; - try { - CompositeDataType * classThreeTypeSpec = - new CompositeDataType(typeDictionary, "ClassThree", sizeof(ClassThree), &construct, &destruct); - int x_dims[] = {2}; - classThreeTypeSpec->addRegularMember( "pos", offsetof(ClassThree, pos), "double", 1, x_dims); - int y_dims[] = {2}; - classThreeTypeSpec->addRegularMember( "vel", offsetof(ClassThree, vel), "double", 1, y_dims); - - typeDictionary->addTypeDefinition("ClassThree", classThreeTypeSpec); - - result = classThreeTypeSpec->validate(); - } catch( std::logic_error e ) { - std::cerr << e.what(); - result = false; - } - return result; -} - -bool addClassFourToTypeDictionary(TypeDictionary* typeDictionary) { - - bool result = false; - try { - CompositeDataType * classFourTypeSpec = - new CompositeDataType(typeDictionary, "ClassFour", sizeof(ClassFour), &construct, &destruct); - int x_dims[] = {2}; - classFourTypeSpec->addRegularMember( "x", offsetof(ClassFour, x), "double", 1, x_dims); - classFourTypeSpec->addBitFieldMember( "f1", get_ClassFour__f1, set_ClassFour__f1); - classFourTypeSpec->addBitFieldMember( "f2", get_ClassFour__f2, set_ClassFour__f2); - classFourTypeSpec->addBitFieldMember( "f3", get_ClassFour__f3, set_ClassFour__f3); - - typeDictionary->addTypeDefinition("ClassFour", classFourTypeSpec); - - result = classFourTypeSpec->validate(); - } catch( std::logic_error e ) { - std::cerr << e.what(); - result = false; - } - return result; -} - -bool addClassFiveToTypeDictionary(TypeDictionary* typeDictionary) { - - bool result = false; - try { - CompositeDataType * classFiveTypeSpec = - new CompositeDataType(typeDictionary, "ClassFive", sizeof(ClassFive), &construct, &destruct); - classFiveTypeSpec->addRegularMember( "x", offsetof(ClassFive, x), "double", 0, NULL); - classFiveTypeSpec->addStaticMember( "count", &ClassFive::count, "int", 0, NULL ); - - typeDictionary->addTypeDefinition("ClassFive", classFiveTypeSpec); - - result = classFiveTypeSpec->validate(); - } catch( std::logic_error e ) { - std::cerr << e.what(); - result = false; - } - return result; -} - -bool addDayOfWeekEnumToTypeDictionary(TypeDictionary* typeDictionary, EnumDictionary* enumDictionary) { - - bool result = false; - try { - EnumDataType * dataType = new EnumDataType( enumDictionary, "DayOfWeek", sizeof(enum DayOfWeek) ); - dataType->addEnumerator( "Sunday", 1); - dataType->addEnumerator( "Monday", 2); - dataType->addEnumerator( "Tuesday", 3); - dataType->addEnumerator( "Wednesday",4); - dataType->addEnumerator( "Thursday", 5); - dataType->addEnumerator( "Friday", 6); - dataType->addEnumerator( "Saturday", 7); - - typeDictionary->addTypeDefinition( "DayOfWeek", dataType ); - result = dataType->validate(); - } catch( std::logic_error e ) { - std::cerr << e.what(); - result = false; - } - return result; -} diff --git a/trick_source/sim_services/DataTypes/testing/DataTypeTestSupport.hh b/trick_source/sim_services/DataTypes/testing/DataTypeTestSupport.hh deleted file mode 100644 index 2e4fa7e5b..000000000 --- a/trick_source/sim_services/DataTypes/testing/DataTypeTestSupport.hh +++ /dev/null @@ -1,74 +0,0 @@ -#include -#include -#include "TypeDictionary.hh" -#include "EnumDictionary.hh" - -// ClassOne contains regular, primitive, unarrayed, data-members. -class ClassOne { - public: - int a; - double b; -}; - -// ClassTwo contains regular, primitive and composite data-members. -class ClassTwo { - public: - int x; - double y; - ClassOne c1; -}; - -// ClassThree contains regular, primitive, arrayed data-members. -class ClassThree { - public: - double pos[2]; - double vel[2]; -}; - -// ClassFour contains bitfield data-members as well as regular, primitive, arrayed data-members. -class ClassFour { - public: - double x[2]; - short f1 : 3; - short f2 : 5; - short f3 : 7; -}; - -// ClassFive contains static and regular, primitive, arrayed data-members. -class ClassFive { - public: - double x; - static int count; -}; - -// An Allocator -template -void* construct (int num) { - T* temp = (T*)calloc( num, sizeof(T)); - for (int ii=0 ; ii -void destruct (void* address) { - free(address); -} - -bool addClassOneToTypeDictionary(TypeDictionary* typeDictionary); -bool addClassTwoToTypeDictionary(TypeDictionary* typeDictionary); -bool addClassThreeToTypeDictionary(TypeDictionary* typeDictionary); -bool addClassFourToTypeDictionary(TypeDictionary* typeDictionary); -bool addClassFiveToTypeDictionary(TypeDictionary* typeDictionary); - -enum DayOfWeek { - Sunday = 1, - Monday = 2, - Tuesday = 3, - Wednesday = 4, - Thursday = 5, - Friday = 6, - Saturday = 7 -}; - -bool addDayOfWeekEnumToTypeDictionary(TypeDictionary* typeDictionary, EnumDictionary* enumDictionary); diff --git a/trick_source/sim_services/DataTypes/testing/EnumDeclarationTest.cpp b/trick_source/sim_services/DataTypes/testing/EnumDeclarationTest.cpp deleted file mode 100644 index a1adb00a4..000000000 --- a/trick_source/sim_services/DataTypes/testing/EnumDeclarationTest.cpp +++ /dev/null @@ -1,186 +0,0 @@ - -#include -#include -#include "EnumDeclaration.hh" -#include "IntegerValue.hh" -#include "TypeDictionary.hh" - -enum DayOfWeek { - Sunday = 1, - Monday = 2, - Tuesday = 3, - Wednesday = 4, - Thursday = 5, - Friday = 6, - Saturday = 7 -}; - -TEST(EnumDeclaration, getters_1 ) { - - // Create a EnumDeclaration. - EnumDeclaration * enum_decl = new EnumDeclaration(0, 0, NULL, sizeof(enum DayOfWeek)); - enum_decl->addEnumerator( "Sunday", 1); - enum_decl->addEnumerator( "Monday", 2); - enum_decl->addEnumerator( "Tuesday", 3); - enum_decl->addEnumerator( "Wednesday",4); - enum_decl->addEnumerator( "Thursday", 5); - enum_decl->addEnumerator( "Friday", 6); - enum_decl->addEnumerator( "Saturday", 7); - - EXPECT_EQ(1, enum_decl->getElementCount()); - EXPECT_EQ(0, enum_decl->getPointerCount()); - EXPECT_EQ(0, enum_decl->getDimensionCount()); - EXPECT_EQ( (int)sizeof(enum DayOfWeek), enum_decl->getElementSize()); - EXPECT_EQ( (int)sizeof(enum DayOfWeek), enum_decl->getSize()); -} - -TEST(EnumDeclaration, toString_1) { - - // Create a EnumDeclaration. - EnumDeclaration * enum_decl = new EnumDeclaration(0, 0, NULL, sizeof(enum DayOfWeek)); - enum_decl->addEnumerator( "Sunday", 1); - enum_decl->addEnumerator( "Monday", 2); - enum_decl->addEnumerator( "Tuesday", 3); - enum_decl->addEnumerator( "Wednesday",4); - enum_decl->addEnumerator( "Thursday", 5); - enum_decl->addEnumerator( "Friday", 6); - enum_decl->addEnumerator( "Saturday", 7); - - // Print the EnumDeclaration. - std::stringstream ss; - ss << enum_decl->toString(); - - // Check the results. - int result = ss.str().compare("enum { Sunday = 1, Monday = 2, Tuesday = 3, Wednesday = 4, Thursday = 5, Friday = 6, Saturday = 7}"); - EXPECT_EQ( 0, result); -} - -TEST(EnumDeclaration, copy_constructor_1) { - - // Create a EnumDeclaration. - EnumDeclaration * enum_decl = new EnumDeclaration(0, 0, NULL, sizeof(enum DayOfWeek)); - enum_decl->addEnumerator( "Sunday", 1); - enum_decl->addEnumerator( "Monday", 2); - enum_decl->addEnumerator( "Tuesday", 3); - enum_decl->addEnumerator( "Wednesday",4); - enum_decl->addEnumerator( "Thursday", 5); - enum_decl->addEnumerator( "Friday", 6); - enum_decl->addEnumerator( "Saturday", 7); - - // Create a duplicate of the EnumDeclaration. - EnumDeclaration * - duplicate_decl = new EnumDeclaration( *enum_decl ); - - // Delete the original. - delete enum_decl; - - // Print the duplicate EnumDeclaration. - std::stringstream ss; - ss << duplicate_decl->toString(); - - // Check the results with what we expected. - int result = ss.str().compare("enum { Sunday = 1, Monday = 2, Tuesday = 3, Wednesday = 4, Thursday = 5, Friday = 6, Saturday = 7}"); - EXPECT_EQ(0, result); -} - -#if 0 -TEST(EnumDeclaration, assignment_operator) { - - EnumDeclaration my_decl; - - // Create a EnumDeclaration. - unsigned int decl_dims[1] = {5}; - EnumDeclaration * original_decl = new EnumDeclaration(1, 1, decl_dims, sizeof(ClassThree)); - unsigned int x_dims[1] = {3}; - original_decl->addRegularMember( "x", offsetof(ClassThree, x), new PrimitiveDeclaration(0, 1, x_dims)); - original_decl->addBitFieldMember( "f1", 3); - original_decl->addBitFieldMember( "f2", 5); - original_decl->addBitFieldMember( "f3", 7); - - my_decl = *original_decl; - - // Delete the original. - delete original_decl; - - // Print the duplicate EnumDeclaration. - std::stringstream ss; - ss << my_decl.toString(); - - // Check the results with what we expected. - int result = ss.str().compare("{\ndouble[3] x;\nshort f1 : 3;\nshort f2 : 5;\nshort f3 : 7;\n}*[5]"); - EXPECT_EQ(0, result); -} -#endif - -TEST(EnumDeclaration, assign_singleton) { - - // Create an instance of type. - enum DayOfWeek day = Monday; - - // Create our own description of the type. - EnumDeclaration * enum_decl = new EnumDeclaration(0, 0, NULL, sizeof(enum DayOfWeek)); - enum_decl->addEnumerator( "Sunday", 1); - enum_decl->addEnumerator( "Monday", 2); - enum_decl->addEnumerator( "Tuesday", 3); - enum_decl->addEnumerator( "Wednesday",4); - enum_decl->addEnumerator( "Thursday", 5); - enum_decl->addEnumerator( "Friday", 6); - enum_decl->addEnumerator( "Saturday", 7); - - // Create a CompositeValue to be assigned to the class instance. - IntegerValue *intVal = new IntegerValue(4); - - // Perform the assignment. - enum_decl->assignValue( &day, intVal); - - // Check that values were correctly assigned to the class instance. - EXPECT_EQ(day , 4); -} - -TEST(EnumDeclaration, print_singleton_value) { - - // Create an instance of type. - enum DayOfWeek day = Monday; - - // Create our own description of the type. - EnumDeclaration * enum_decl = new EnumDeclaration(0, 0, NULL, sizeof(enum DayOfWeek)); - enum_decl->addEnumerator( "Sunday", 1); - enum_decl->addEnumerator( "Monday", 2); - enum_decl->addEnumerator( "Tuesday", 3); - enum_decl->addEnumerator( "Wednesday",4); - enum_decl->addEnumerator( "Thursday", 5); - enum_decl->addEnumerator( "Friday", 6); - enum_decl->addEnumerator( "Saturday", 7); - - std::stringstream ss; - enum_decl->printValue(ss, &day); - - int result = ss.str().compare("Monday"); - - EXPECT_EQ(0, result); - - - class Foo { public : Foo () { - TypeDictionary * type_dict = TypeDictionary::getInstance(); - - EnumDeclaration * enum_decl = new EnumDeclaration(0, 0, NULL, sizeof(enum DayOfWeek)); - enum_decl->addEnumerator( "Sunday", 1); - enum_decl->addEnumerator( "Monday", 2); - enum_decl->addEnumerator( "Tuesday", 3); - enum_decl->addEnumerator( "Wednesday",4); - enum_decl->addEnumerator( "Thursday", 5); - enum_decl->addEnumerator( "Friday", 6); - enum_decl->addEnumerator( "Saturday", 7); - - type_dict->addTypeDeclaration("Foo", enum_decl); - - std::stringstream ss; - ss << enum_decl->toString(); - ss << "============================================" << std::endl; - ss << type_dict->toString(); - std::cout << ss.str() << std::endl; - - - } }; Foo __Foo; - -} diff --git a/trick_source/sim_services/DataTypes/testing/EnumTypeSpecTest.cpp b/trick_source/sim_services/DataTypes/testing/EnumTypeSpecTest.cpp deleted file mode 100644 index 9a50f6660..000000000 --- a/trick_source/sim_services/DataTypes/testing/EnumTypeSpecTest.cpp +++ /dev/null @@ -1,166 +0,0 @@ -#include -#include -#include -#include "TypeDictionary.hh" -#include "EnumDataType.hh" -#include "IntegerValue.hh" - -enum DayOfWeek { - Sunday = 1, - Monday = 2, - Tuesday = 3, - Wednesday = 4, - Thursday = 5, - Friday = 6, - Saturday = 7 -}; - -enum Fruit { - Apple = 0, - Pear = 1, - Lemon = 2, - Orange = 3 -}; - -// Framework -class EnumDataTypeTest : public ::testing::Test { - protected: - TypeDictionary *typeDictionary; - EnumDictionary *enumDictionary; - EnumDataTypeTest() { - typeDictionary = new TypeDictionary; - enumDictionary = new EnumDictionary; - } - ~EnumDataTypeTest() { - delete typeDictionary; - delete enumDictionary; - } - void SetUp() {} - void TearDown() {} -}; - -bool addDayOfWeekEnumToTypeDictionary(TypeDictionary* typeDictionary, EnumDictionary* enumDictionary) { - bool result = false; - try { - EnumDataType * dataType = new EnumDataType( enumDictionary, "DayOfWeek", sizeof(enum DayOfWeek) ); - dataType->addEnumerator( "Sunday", 1); - dataType->addEnumerator( "Monday", 2); - dataType->addEnumerator( "Tuesday", 3); - dataType->addEnumerator( "Wednesday",4); - dataType->addEnumerator( "Thursday", 5); - dataType->addEnumerator( "Friday", 6); - dataType->addEnumerator( "Saturday", 7); - - typeDictionary->addTypeDefinition( "DayOfWeek", dataType ); - result = dataType->validate(); - - } catch ( std::logic_error e ) { - std::cerr << e.what(); - result = false; - } - return result; -} - -/* ================================================================================ - Test Cases - ================================================================================ -*/ -TEST_F(EnumDataTypeTest, addEnumerator_normal ) { - - bool test_result = false; - test_result = addDayOfWeekEnumToTypeDictionary(typeDictionary, enumDictionary); - EXPECT_EQ(true, test_result); -} - -TEST_F(EnumDataTypeTest, addEnumerator_exception ) { - - std::cout << "===== Expecting an error message about the re-definition of an enumerator type. =====" << std::endl; - - bool test_result = true; - - // Create a EnumDeclaration. - EnumDataType * dataType = new EnumDataType( enumDictionary, "Fruit", sizeof(enum Fruit) ); - try { - dataType->addEnumerator( "Apple", 0); - dataType->addEnumerator( "Pear", 1); - dataType->addEnumerator( "Lemon", 2); - dataType->addEnumerator( "Orange", 3); - dataType->addEnumerator( "Orange", 3); - - typeDictionary->addTypeDefinition( "Fruit", dataType ); - test_result = dataType->validate(); - - } catch ( std::logic_error e ) { - std::cerr << e.what(); - // We are expecting an exception because "Orange" is added twice. - test_result = true; - } - EXPECT_EQ(true, test_result); -} - -TEST_F(EnumDataTypeTest, getSize ) { - - EnumDataType * dataType = new EnumDataType( enumDictionary, "DayOfWeek", sizeof(enum DayOfWeek) ); - EXPECT_EQ( (int)sizeof(enum DayOfWeek), dataType->getSize()); -} - -TEST_F(EnumDataTypeTest, toString ) { - - EXPECT_EQ(true, addDayOfWeekEnumToTypeDictionary(typeDictionary, enumDictionary)); - - const DataType* dataType = typeDictionary->getDataType("DayOfWeek"); - ASSERT_TRUE(dataType != NULL) ; - - // Print the duplicate CompositeDataType. - std::string s; - s = dataType->toString(); - - // Check the results. - EXPECT_EQ("enum {\nSunday = 1,\n" - "Monday = 2,\n" - "Tuesday = 3,\n" - "Wednesday = 4,\n" - "Thursday = 5,\n" - "Friday = 6,\n" - "Saturday = 7}\n",s); -} - -TEST_F(EnumDataTypeTest, AssignValue ) { - - EXPECT_EQ(true, addDayOfWeekEnumToTypeDictionary( typeDictionary, enumDictionary)); - - const DataType* dataType = typeDictionary->getDataType("DayOfWeek"); - ASSERT_TRUE(dataType != NULL) ; - - DayOfWeek dayOfWeek = Sunday; - - try { - int value = enumDictionary->getValue( "Wednesday" ); - IntegerValue *integerValue = new IntegerValue( value ); - dataType->assignValue( &dayOfWeek, integerValue ); - delete integerValue; - } catch ( std::logic_error e ) { - std::cerr << e.what(); - } - - EXPECT_EQ(Wednesday, dayOfWeek); -} - -TEST_F(EnumDataTypeTest, printValue ) { - - EXPECT_EQ(true, addDayOfWeekEnumToTypeDictionary( typeDictionary, enumDictionary)); - - const DataType* dataType = typeDictionary->getDataType("DayOfWeek"); - - ASSERT_TRUE(dataType != NULL) ; - - DayOfWeek dayOfWeek = Monday; - - std::stringstream ss; - - dataType->printValue(ss, &dayOfWeek); - - int result = ss.str().compare("Monday"); - - EXPECT_EQ(0, result); -} diff --git a/trick_source/sim_services/DataTypes/testing/LexicalAnalyzerTest.cpp b/trick_source/sim_services/DataTypes/testing/LexicalAnalyzerTest.cpp deleted file mode 100644 index f73105877..000000000 --- a/trick_source/sim_services/DataTypes/testing/LexicalAnalyzerTest.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include -#include -#include "LexicalAnalyzer.hh" -#include - -TEST(LexicalAnalyzer, test1) { - - Token::e token; - LexicalAnalyzer lexer; - - lexer.load("float"); - token = lexer.getToken(); - EXPECT_EQ(Token::Float, token ); - - token = lexer.nextToken(); - EXPECT_EQ(Token::EndOfFile, token ); -} - -TEST(LexicalAnalyzer, test2) { - - Token::e token; - LexicalAnalyzer lexer; - - lexer.load("double(*)[123]"); - - token = lexer.getToken(); - - EXPECT_EQ(Token::Double, token ); - - token = lexer.matchToken(Token::Double); - - EXPECT_EQ(Token::LeftParen, token ); - - token = lexer.matchToken(Token::LeftParen); - - EXPECT_EQ(Token::Asterisk, token ); - - token = lexer.matchToken(Token::Asterisk); - - EXPECT_EQ(Token::RightParen, token ); - - token = lexer.matchToken(Token::RightParen); - - EXPECT_EQ(Token::LeftBracket, token ); - - token = lexer.matchToken(Token::LeftBracket); - - EXPECT_EQ(Token::Integer, token ); - - token = lexer.matchToken(Token::Integer); - - EXPECT_EQ(Token::RightBracket, token ); - - token = lexer.matchToken(Token::RightBracket); - - EXPECT_EQ(Token::EndOfFile, token ); -} - diff --git a/trick_source/sim_services/DataTypes/testing/ParsedDeclarationTest.cpp b/trick_source/sim_services/DataTypes/testing/ParsedDeclarationTest.cpp deleted file mode 100644 index 185fa31c7..000000000 --- a/trick_source/sim_services/DataTypes/testing/ParsedDeclarationTest.cpp +++ /dev/null @@ -1,119 +0,0 @@ -#include -#include -#include "ParsedDeclaration.hh" -#include - -TEST(ParsedDeclaration, test1) { - - std::cout << "TEST1: float*baz[3]" << std::endl; - ParsedDeclaration* parsedDeclaration = new ParsedDeclaration("float*baz[3]"); - - std::string typeSpecString = parsedDeclaration->getTypeSpecifier(); - EXPECT_EQ( "float", typeSpecString ); - - std::string varName = parsedDeclaration->getVariableName(); - EXPECT_EQ( "baz", varName ); - - unsigned int ndims = parsedDeclaration->getNumberOfDimensions(); - unsigned int dim_0 = parsedDeclaration->getDimensionSize(0); - unsigned int dim_1 = parsedDeclaration->getDimensionSize(1); - - EXPECT_EQ( 2, ndims ); - EXPECT_EQ( 3, dim_0 ); - EXPECT_EQ(-1, dim_1 ); -} - - -TEST(ParsedDeclaration, test2) { - - std::cout << "TEST2: float(*)[3]" << std::endl; - ParsedDeclaration* parsedDeclaration = new ParsedDeclaration("float(*)[3]"); - - std::string typeSpecString = parsedDeclaration->getTypeSpecifier(); - EXPECT_EQ( "float", typeSpecString ); - - std::string varName = parsedDeclaration->getVariableName(); - EXPECT_EQ( "", varName ); - - unsigned int ndims = parsedDeclaration->getNumberOfDimensions(); - ASSERT_EQ( 2, ndims ); - - unsigned int dim_0 = parsedDeclaration->getDimensionSize(0); - unsigned int dim_1 = parsedDeclaration->getDimensionSize(1); - - EXPECT_EQ(-1, dim_0 ); - EXPECT_EQ( 3, dim_1 ); -} - - -TEST(ParsedDeclaration, test3) { - - ParsedDeclaration* parsedDeclaration = new ParsedDeclaration("int**[3][4]"); - - std::string typeSpecString = parsedDeclaration->getTypeSpecifier(); - EXPECT_EQ( "int", typeSpecString ); - - std::string varName = parsedDeclaration->getVariableName(); - EXPECT_EQ( "", varName ); - - unsigned int ndims = parsedDeclaration->getNumberOfDimensions(); - ASSERT_EQ( 4, ndims ); - - unsigned int dim_0 = parsedDeclaration->getDimensionSize(0); - unsigned int dim_1 = parsedDeclaration->getDimensionSize(1); - unsigned int dim_2 = parsedDeclaration->getDimensionSize(2); - unsigned int dim_3 = parsedDeclaration->getDimensionSize(3); - - EXPECT_EQ( 3, dim_0 ); - EXPECT_EQ( 4, dim_1 ); - EXPECT_EQ(-1, dim_2 ); - EXPECT_EQ(-1, dim_3 ); -} - -TEST(ParsedDeclaration, test4) { - - ParsedDeclaration* parsedDeclaration = new ParsedDeclaration("int*(*foo)[3][4]"); - - std::string typeSpecString = parsedDeclaration->getTypeSpecifier(); - EXPECT_EQ( "int", typeSpecString ); - - std::string varName = parsedDeclaration->getVariableName(); - EXPECT_EQ( "foo", varName ); - - unsigned int ndims = parsedDeclaration->getNumberOfDimensions(); - ASSERT_EQ( 4, ndims ); - - unsigned int dim_0 = parsedDeclaration->getDimensionSize(0); - unsigned int dim_1 = parsedDeclaration->getDimensionSize(1); - unsigned int dim_2 = parsedDeclaration->getDimensionSize(2); - unsigned int dim_3 = parsedDeclaration->getDimensionSize(3); - - EXPECT_EQ(-1, dim_0 ); - EXPECT_EQ( 3, dim_1 ); - EXPECT_EQ( 4, dim_2 ); - EXPECT_EQ(-1, dim_3 ); -} - -TEST(ParsedDeclaration, test5) { - - ParsedDeclaration* parsedDeclaration = new ParsedDeclaration("int*(*)[3][4]"); - - std::string typeSpecString = parsedDeclaration->getTypeSpecifier(); - EXPECT_EQ( "int", typeSpecString ); - - std::string varName = parsedDeclaration->getVariableName(); - EXPECT_EQ( "", varName ); - - unsigned int ndims = parsedDeclaration->getNumberOfDimensions(); - ASSERT_EQ( 4, ndims ); - - unsigned int dim_0 = parsedDeclaration->getDimensionSize(0); - unsigned int dim_1 = parsedDeclaration->getDimensionSize(1); - unsigned int dim_2 = parsedDeclaration->getDimensionSize(2); - unsigned int dim_3 = parsedDeclaration->getDimensionSize(3); - - EXPECT_EQ(-1, dim_0 ); - EXPECT_EQ( 3, dim_1 ); - EXPECT_EQ( 4, dim_2 ); - EXPECT_EQ(-1, dim_3 ); -} diff --git a/trick_source/sim_services/DataTypes/testing/PointerTypeSpecTest.cpp b/trick_source/sim_services/DataTypes/testing/PointerTypeSpecTest.cpp deleted file mode 100644 index c40f70f68..000000000 --- a/trick_source/sim_services/DataTypes/testing/PointerTypeSpecTest.cpp +++ /dev/null @@ -1,230 +0,0 @@ -#include -#include -#include -#include "TypeDictionary.hh" -#include "PointerDataType.hh" -#include "PointerValue.hh" - -/* ================================================================================ - Test Cases - ================================================================================ -*/ -TEST( PointerDataType , constructor_exception ) { - - // Attempt to create type a PointerDataType with 0 pointers. - // This attempt should throw an exception. - - std::cout << "===== Expecting exception and corresponding message. =====" << std::endl; - - PointerDataType * ptrTypeSpec; - bool constructor_result = true; - try { - ptrTypeSpec = new PointerDataType("double", 0); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - constructor_result = false; - } - - // Verify that an exception was raised. - EXPECT_EQ(false, constructor_result); - - // Clean up. - if (constructor_result) { - delete ptrTypeSpec; - } -} - -TEST( PointerDataType, copy_constructor ) { - - // Create a PointerDataType. - PointerDataType* orig = new PointerDataType("float", 3); - - // Duplicate it. - PointerDataType* copy = new PointerDataType( *(const PointerDataType*)orig ); - - // Verify that the duplicate PointerDataType is what we expect. - std::stringstream ss; - ss << copy->toString(); - int result = ss.str().compare("float***"); - EXPECT_EQ(0, result); - - // Clean up. - delete copy; - delete orig; -} - -TEST( PointerDataType , operator_equal ) { - - // Create a PointerDataType. - PointerDataType* orig = new PointerDataType("long", 2); - - // Assign it to another PointerDataType. - PointerDataType copy = *(const PointerDataType*)orig; - - // Verify that the assigned PointerDataType is what we expect. - std::stringstream ss; - ss << copy.toString(); - int result = ss.str().compare("long**"); - EXPECT_EQ(0, result); - - // Clean up. - delete orig; -} - -TEST( PointerDataType , clone ) { - - // Create a PointerDataType. - PointerDataType* orig = new PointerDataType("int", 2); - - // Clone it. - DataType * copy = orig->clone(); - - // Verify that the cloned PointerDataType is what we expect. - std::stringstream ss; - ss << copy->toString(); - int result = ss.str().compare("int**"); - EXPECT_EQ(0, result); - - // Clean up. - delete orig; - delete copy; -} - -TEST( PointerDataType , getSize ) { - - // Create a PointerDataType. - PointerDataType* ptrTypeSpec = new PointerDataType("long", 2); - - // Verify that getSize returns the size of a pointer. - EXPECT_EQ( sizeof(void*), ptrTypeSpec->getSize()); -} - -TEST( PointerDataType , assignValue ) { - - double d = 1.2345; - double * d_ptr; - - // Create a PointerDataType. - PointerDataType* ptrTypeSpec = new PointerDataType("double", 1); - - PointerValue * ptrValue = new PointerValue(&d); - ptrTypeSpec->assignValue(&d_ptr, ptrValue); - - EXPECT_EQ(1.2345, *d_ptr); -} - -TEST( PointerDataType , printValue ) { - - double * d_ptr = (double*)0x12345678; - - // Create a PointerDataType. - PointerDataType* ptrTypeSpec = new PointerDataType("double", 1); - - // Verify that printValue prints the value that we expect. - std::stringstream ss; - ptrTypeSpec->printValue(ss, &d_ptr); - int result = ss.str().compare("0x12345678"); - - EXPECT_EQ(0, result); -} - -TEST( PointerDataType , validate_1 ) { - - // Create a PointerDataType. - PointerDataType* ptrTypeSpec = new PointerDataType("double", 1); - - // Validate the Type. - bool validation_result = ptrTypeSpec->validate(); - - // Verify that validation succeeded. - ASSERT_EQ(true, validation_result); - -} - -TEST( PointerDataType , validate_2 ) { - - std::cout << "===== Expecting an error message about an undefined type. =====" << std::endl; - - // Create a PointerDataType. - PointerDataType* ptrTypeSpec = new PointerDataType("Undefined_Type", 1); - - // Validate the Type. - bool validation_result = ptrTypeSpec->validate(); - - // Verify that validation failed. - ASSERT_EQ(false, validation_result); - -} - -TEST( PointerDataType , getDereferencedType_1 ) { - - // Create type: double** - PointerDataType * ptrTypeSpec; - bool constructor_result = true; - try { - ptrTypeSpec = new PointerDataType("double", 2); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - constructor_result = false; - } - ASSERT_EQ(true, constructor_result); - - // Validate the Type. - bool validation_result = ptrTypeSpec->validate(); - ASSERT_EQ(true, validation_result); - - // Dereference the type. - const DataType * dereferencedPtrTypeSpec; - bool dereference_result = true; - try { - dereferencedPtrTypeSpec = ptrTypeSpec->getDereferencedType(); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - dereference_result = false; - } - ASSERT_EQ(true, dereference_result); - - // Result of the dereference should be: double* - std::stringstream ss; - ss << dereferencedPtrTypeSpec->toString(); - int comparision_result = ss.str().compare("double*"); - - EXPECT_EQ(0, comparision_result); - -} - -TEST( PointerDataType , getDereferencedType_2 ) { - - // Create type: double* - PointerDataType * ptrTypeSpec; - bool constructor_result = true; - try { - ptrTypeSpec = new PointerDataType("double", 1); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - constructor_result = false; - } - ASSERT_EQ(true, constructor_result); - - // Validate the Type. - bool validation_result = ptrTypeSpec->validate(); - ASSERT_EQ(true, validation_result); - - // Dereference the type. - const DataType * dereferencedPtrTypeSpec; - bool dereference_result = true; - try { - dereferencedPtrTypeSpec = ptrTypeSpec->getDereferencedType(); - } catch ( std::logic_error e ) { - std::cerr << e.what(); - dereference_result = false; - } - ASSERT_EQ(true, dereference_result); - - // Result of the dereference should be: double - std::stringstream ss; - ss << dereferencedPtrTypeSpec->toString(); - int comparision_result = ss.str().compare("double"); - - EXPECT_EQ(0, comparision_result); -} diff --git a/trick_source/sim_services/DataTypes/testing/PrimTypeSpecTest.cpp b/trick_source/sim_services/DataTypes/testing/PrimTypeSpecTest.cpp deleted file mode 100644 index a14f57eac..000000000 --- a/trick_source/sim_services/DataTypes/testing/PrimTypeSpecTest.cpp +++ /dev/null @@ -1,529 +0,0 @@ -#include -#include -#include -#include "TypeDictionary.hh" -#include "PrimitiveDataType.hh" - -class PrimitiveDataTypeTest : public ::testing::Test { - protected: - TypeDictionary *typeDictionary; - PrimitiveDataTypeTest() { typeDictionary = new TypeDictionary; } - ~PrimitiveDataTypeTest() { delete typeDictionary; } - void SetUp() {} - void TearDown() {} -}; - -template -void validate_getSize(size_t expectedSize) { - PrimitiveDataType * primTypeSpec = new PrimitiveDataType(); - size_t test_result = primTypeSpec->getSize(); - delete primTypeSpec; - EXPECT_EQ(expectedSize, test_result); -} - -template -void validate_printValue(T& testVar, const char* expectedString) { - std::stringstream ss; - PrimitiveDataType * primTypeSpec = new PrimitiveDataType(); - primTypeSpec->printValue(ss, &testVar); - int result = ss.str().compare(expectedString); - delete primTypeSpec; - EXPECT_EQ(0, result); -} - -template -void validate_toString(const char* expectedString) { - std::string s; - PrimitiveDataType * primTypeSpec = new PrimitiveDataType(); - s = primTypeSpec->toString(); - int result = s.compare(expectedString); - delete primTypeSpec; - EXPECT_EQ(0, result); -} - -template -void validate_isFloatingPoint(bool expectedResult) { - PrimitiveDataType * primTypeSpec = new PrimitiveDataType(); - bool result = primTypeSpec->isFloatingPoint(); - delete primTypeSpec; - EXPECT_EQ(expectedResult, result); -} - -template -void validate_isSigned(bool expectedResult) { - PrimitiveDataType * primTypeSpec = new PrimitiveDataType(); - bool result = primTypeSpec->isSigned(); - delete primTypeSpec; - EXPECT_EQ(expectedResult, result); -} - -template -void validate_isVoid(bool expectedResult) { - PrimitiveDataType * primTypeSpec = new PrimitiveDataType(); - bool result = primTypeSpec->isVoid(); - delete primTypeSpec; - EXPECT_EQ(expectedResult, result); -} - -/* ================================================================================ - Test Cases - ================================================================================ -*/ -TEST_F(PrimitiveDataTypeTest, validate ) { - - /* PrimitiveDataType is always valid, because it is a fundemental, builtin type. */ - PrimitiveDataType * primTypeSpec = new PrimitiveDataType(); - - bool test_result; - test_result = primTypeSpec->validate(); - - EXPECT_EQ(true, test_result); -} - -TEST_F(PrimitiveDataTypeTest, getSize_void) { - validate_getSize(0); -} - -TEST_F(PrimitiveDataTypeTest, getSize_char) { - validate_getSize((int)sizeof(char)); -} - -TEST_F(PrimitiveDataTypeTest, getSize_short) { - validate_getSize((int)sizeof(short)); -} - -TEST_F(PrimitiveDataTypeTest, getSize_int) { - validate_getSize((int)sizeof(int)); -} - -TEST_F(PrimitiveDataTypeTest, getSize_long) { - validate_getSize((int)sizeof(long)); -} - -TEST_F(PrimitiveDataTypeTest, getSize_long_long) { - validate_getSize((int)sizeof(long long)); -} - -TEST_F(PrimitiveDataTypeTest, getSize_unsigned_char) { - validate_getSize((int)sizeof(unsigned char)); -} - -TEST_F(PrimitiveDataTypeTest, getSize_unsigned_short) { - validate_getSize((int)sizeof(unsigned short)); -} - -TEST_F(PrimitiveDataTypeTest, getSize_unsigned_int) { - validate_getSize((int)sizeof(unsigned int)); -} - -TEST_F(PrimitiveDataTypeTest, getSize_unsigned_long) { - validate_getSize((int)sizeof(unsigned long)); -} - -TEST_F(PrimitiveDataTypeTest, getSize_unsigned_long_long) { - validate_getSize((int)sizeof(unsigned long long)); -} - -TEST_F(PrimitiveDataTypeTest, getSize_wchar_t) { - validate_getSize((int)sizeof(wchar_t)); -} - -TEST_F(PrimitiveDataTypeTest, getSize_float) { - validate_getSize((int)sizeof(float)); -} - -TEST_F(PrimitiveDataTypeTest, getSize_double) { - validate_getSize((int)sizeof(double)); -} - -// ----------------------------------------------------------------------------------------- -// assignValue tests -// ----------------------------------------------------------------------------------------- - -TEST_F(PrimitiveDataTypeTest, assignValue_char) { - char test_var = '\0'; - PrimitiveDataType * primTypeSpec = new PrimitiveDataType(); - IntegerValue * value = new IntegerValue((int)'A'); - primTypeSpec->assignValue(&test_var, value); - delete value; - delete primTypeSpec; - EXPECT_EQ('A', test_var); -} - -TEST_F(PrimitiveDataTypeTest, assignValue_short) { - short test_var = 0; - PrimitiveDataType * primTypeSpec = new PrimitiveDataType(); - IntegerValue * value = new IntegerValue(314); - primTypeSpec->assignValue(&test_var, value); - delete value; - delete primTypeSpec; - EXPECT_EQ(314, test_var); -} - -TEST_F(PrimitiveDataTypeTest, assignValue_int) { - int test_var = 0; - PrimitiveDataType * primTypeSpec = new PrimitiveDataType(); - IntegerValue * value = new IntegerValue(723); - primTypeSpec->assignValue(&test_var, value); - delete value; - delete primTypeSpec; - EXPECT_EQ(723, test_var); -} - -TEST_F(PrimitiveDataTypeTest, assignValue_long) { - long test_var = 0; - PrimitiveDataType * primTypeSpec = new PrimitiveDataType(); - IntegerValue * value = new IntegerValue(723); - primTypeSpec->assignValue(&test_var, value); - delete value; - delete primTypeSpec; - EXPECT_EQ(723, test_var); -} - -TEST_F(PrimitiveDataTypeTest, assignValue_long_long) { - long long test_var = 0; - PrimitiveDataType * primTypeSpec = new PrimitiveDataType(); - IntegerValue * value = new IntegerValue(723); - primTypeSpec->assignValue(&test_var, value); - delete value; - delete primTypeSpec; - EXPECT_EQ(723, test_var); -} - -TEST_F(PrimitiveDataTypeTest, assignValue_float) { - float test_var = 0.0; - PrimitiveDataType * primTypeSpec = new PrimitiveDataType(); - FloatingPointValue * value = new FloatingPointValue(2.7182818); - primTypeSpec->assignValue(&test_var, value); - delete value; - delete primTypeSpec; - EXPECT_NEAR(2.7182818, test_var, 0.000001); -} - -TEST_F(PrimitiveDataTypeTest, assignValue_double) { - double test_var = 0.0; - PrimitiveDataType * primTypeSpec = new PrimitiveDataType(); - FloatingPointValue * value = new FloatingPointValue(3.1415927); - primTypeSpec->assignValue(&test_var, value); - delete value; - delete primTypeSpec; - EXPECT_NEAR(3.1415927, test_var, 0.000001); -} - -// ----------------------------------------------------------------------------------------- -// printValue tests -// ----------------------------------------------------------------------------------------- -TEST_F(PrimitiveDataTypeTest, printValue_char ) { - char testVar = 'B'; - validate_printValue(testVar, "'B'"); -} - -TEST_F(PrimitiveDataTypeTest, printValue_char_2 ) { - /* Unprintable chars. */ - char testVar = '\01'; - validate_printValue(testVar, "1"); -} - -TEST_F(PrimitiveDataTypeTest, printValue_short ) { - short testVar = -1234; - validate_printValue(testVar, "-1234"); -} - -TEST_F(PrimitiveDataTypeTest, printValue_int ) { - int testVar = -1234; - validate_printValue(testVar, "-1234"); -} - -TEST_F(PrimitiveDataTypeTest, printValue_long ) { - long testVar = -1234; - validate_printValue(testVar, "-1234"); -} - -TEST_F(PrimitiveDataTypeTest, printValue_long_long ) { - long long testVar = -1234; - validate_printValue(testVar, "-1234"); -} - -TEST_F(PrimitiveDataTypeTest, printValue_unsigned_char ) { - unsigned char testVar = 'B'; - validate_printValue(testVar, "'B'"); -} - -TEST_F(PrimitiveDataTypeTest, printValue_unsigned_short ) { - unsigned short testVar = 1234; - validate_printValue(testVar, "1234"); -} - -TEST_F(PrimitiveDataTypeTest, printValue_unsigned_int ) { - unsigned int testVar = 1234; - validate_printValue(testVar, "1234"); -} - -TEST_F(PrimitiveDataTypeTest, printValue_unsigned_long ) { - unsigned long testVar = 1234; - validate_printValue(testVar, "1234"); -} - -TEST_F(PrimitiveDataTypeTest, printValue_unsigned_long_long ) { - unsigned long long testVar = 1234; - validate_printValue(testVar, "1234"); -} - -TEST_F(PrimitiveDataTypeTest, printValue_wchar_t ) { - wchar_t testVar = 1234; - validate_printValue(testVar, "1234"); -} - -TEST_F(PrimitiveDataTypeTest, printValue_float ) { - float testVar = 3.14159; - validate_printValue(testVar, "3.14159"); -} - -TEST_F(PrimitiveDataTypeTest, printValue_double ) { - double testVar = 3.14159; - validate_printValue(testVar, "3.14159"); -} - -// ----------------------------------------------------------------------------------------- -// toString tests -// ----------------------------------------------------------------------------------------- -TEST_F(PrimitiveDataTypeTest, toString_void ) { - validate_toString("void"); -} - -TEST_F(PrimitiveDataTypeTest, toString_char ) { - validate_toString("char"); -} - -TEST_F(PrimitiveDataTypeTest, toString_short ) { - validate_toString("short"); -} - -TEST_F(PrimitiveDataTypeTest, toString_int ) { - validate_toString("int"); -} - -TEST_F(PrimitiveDataTypeTest, toString_long ) { - validate_toString("long"); -} - -TEST_F(PrimitiveDataTypeTest, toString_long_long ) { - validate_toString("long long"); -} - -TEST_F(PrimitiveDataTypeTest, toString_unsigned_char ) { - validate_toString("unsigned char"); -} - -TEST_F(PrimitiveDataTypeTest, toString_unsigned_short ) { - validate_toString("unsigned short"); -} - -TEST_F(PrimitiveDataTypeTest, toString_unsigned_int ) { - validate_toString("unsigned int"); -} - -TEST_F(PrimitiveDataTypeTest, toString_unsigned_long ) { - validate_toString("unsigned long"); -} - -TEST_F(PrimitiveDataTypeTest, toString_unsigned_long_long ) { - validate_toString("unsigned long long"); -} - -TEST_F(PrimitiveDataTypeTest, toString_wchar_t ) { - validate_toString("wchar_t"); -} - -TEST_F(PrimitiveDataTypeTest, toString_float ) { - validate_toString("float"); -} - -TEST_F(PrimitiveDataTypeTest, toString_double ) { - validate_toString("double"); -} - -// ----------------------------------------------------------------------------------------- -// isFloatingPoint tests -// ----------------------------------------------------------------------------------------- -TEST_F(PrimitiveDataTypeTest, isFloatingPoint_void ) { - validate_isFloatingPoint(false); -} - -TEST_F(PrimitiveDataTypeTest, isFloatingPoint_char ) { - validate_isFloatingPoint(false); -} - -TEST_F(PrimitiveDataTypeTest, isFloatingPoint_short ) { - validate_isFloatingPoint(false); -} - -TEST_F(PrimitiveDataTypeTest, isFloatingPoint_int ) { - validate_isFloatingPoint(false); -} - -TEST_F(PrimitiveDataTypeTest, isFloatingPoint_long ) { - validate_isFloatingPoint(false); -} - -TEST_F(PrimitiveDataTypeTest, isFloatingPoint_long_long ) { - validate_isFloatingPoint(false); -} - -TEST_F(PrimitiveDataTypeTest, isFloatingPoint_unsigned_char ) { - validate_isFloatingPoint(false); -} - -TEST_F(PrimitiveDataTypeTest, isFloatingPoint_unsigned_short ) { - validate_isFloatingPoint(false); -} - -TEST_F(PrimitiveDataTypeTest, isFloatingPoint_unsigned_int ) { - validate_isFloatingPoint(false); -} - -TEST_F(PrimitiveDataTypeTest, isFloatingPoint_unsigned_long ) { - validate_isFloatingPoint(false); -} - -TEST_F(PrimitiveDataTypeTest, isFloatingPoint_unsigned_long_long ) { - validate_isFloatingPoint(false); -} - -TEST_F(PrimitiveDataTypeTest, isFloatingPoint_float ) { - validate_isFloatingPoint(true); -} - -TEST_F(PrimitiveDataTypeTest, isFloatingPoint_double ) { - validate_isFloatingPoint(true); -} - -// ----------------------------------------------------------------------------------------- -// isSigned tests -// ----------------------------------------------------------------------------------------- -TEST_F(PrimitiveDataTypeTest, isSigned_void ) { - validate_isSigned(false); -} - -TEST_F(PrimitiveDataTypeTest, isSigned_char ) { - validate_isSigned(true); -} - -TEST_F(PrimitiveDataTypeTest, isSigned_short ) { - validate_isSigned(true); -} - -TEST_F(PrimitiveDataTypeTest, isSigned_int ) { - validate_isSigned(true); -} - -TEST_F(PrimitiveDataTypeTest, isSigned_long ) { - validate_isSigned(true); -} - -TEST_F(PrimitiveDataTypeTest, isSigned_long_long ) { - validate_isSigned(true); -} - -TEST_F(PrimitiveDataTypeTest, isSigned_unsigned_char ) { - validate_isSigned(false); -} - -TEST_F(PrimitiveDataTypeTest, isSigned_unsigned_short ) { - validate_isSigned(false); -} - -TEST_F(PrimitiveDataTypeTest, isSigned_unsigned_int ) { - validate_isSigned(false); -} - -TEST_F(PrimitiveDataTypeTest, isSigned_unsigned_long ) { - validate_isSigned(false); -} - -TEST_F(PrimitiveDataTypeTest, isSigned_unsigned_long_long ) { - validate_isSigned(false); -} - -TEST_F(PrimitiveDataTypeTest, isSigned_wchar_t ) { - validate_isSigned(false); -} - -TEST_F(PrimitiveDataTypeTest, isSigned_float ) { - validate_isSigned(false); -} - -TEST_F(PrimitiveDataTypeTest, isSigned_double ) { - validate_isSigned(false); -} - -// ----------------------------------------------------------------------------------------- -// isVoid tests -// ----------------------------------------------------------------------------------------- -TEST_F(PrimitiveDataTypeTest, isVoid_void ) { - validate_isVoid(true); -} - -TEST_F(PrimitiveDataTypeTest, isVoid_char ) { - validate_isVoid(false); -} - -TEST_F(PrimitiveDataTypeTest, isVoid_short ) { - validate_isVoid(false); -} - -TEST_F(PrimitiveDataTypeTest, isVoid_int ) { - validate_isVoid(false); -} - -TEST_F(PrimitiveDataTypeTest, isVoid_long ) { - validate_isVoid(false); -} - -TEST_F(PrimitiveDataTypeTest, isVoid_long_long ) { - validate_isVoid(false); -} - -TEST_F(PrimitiveDataTypeTest, isVoid_unsigned_char ) { - validate_isVoid(false); -} - -TEST_F(PrimitiveDataTypeTest, isVoid_unsigned_short ) { - validate_isVoid(false); -} - -TEST_F(PrimitiveDataTypeTest, isVoid_unsigned_int ) { - validate_isVoid(false); -} - -TEST_F(PrimitiveDataTypeTest, isVoid_unsigned_long ) { - validate_isVoid(false); -} - -TEST_F(PrimitiveDataTypeTest, isVoid_unsigned_long_long ) { - validate_isVoid(false); -} - -TEST_F(PrimitiveDataTypeTest, isVoid_wchar_t ) { - validate_isVoid(false); -} - -TEST_F(PrimitiveDataTypeTest, isVoid_float ) { - validate_isVoid(false); -} - -TEST_F(PrimitiveDataTypeTest, isVoid_double ) { - validate_isVoid(false); -} - -TEST_F(PrimitiveDataTypeTest, createInstance_char) { - - PrimitiveDataType * primTypeSpec = new PrimitiveDataType(); - char* test_var = (char*)primTypeSpec->createInstance(1); - IntegerValue * value = new IntegerValue((int)'A'); - primTypeSpec->assignValue(test_var, value); - delete value; - delete primTypeSpec; - EXPECT_EQ('A', *test_var); -} - diff --git a/trick_source/sim_services/DataTypes/testing/TypeDictionaryTest.cpp b/trick_source/sim_services/DataTypes/testing/TypeDictionaryTest.cpp deleted file mode 100644 index 4b3a61e6d..000000000 --- a/trick_source/sim_services/DataTypes/testing/TypeDictionaryTest.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include -#include -#include "TypeDictionary.hh" -#include "CompositeDataType.hh" -#include "CompositeValue.hh" -#include "PrimitiveDataType.hh" -#include "DataTypeTestSupport.hh" - -// Framework -class TypeDictionaryTest : public ::testing::Test { - protected: - TypeDictionary *typeDictionary; - TypeDictionaryTest() { typeDictionary = new TypeDictionary; } - ~TypeDictionaryTest() { delete typeDictionary; } - void SetUp() {} - void TearDown() {} -}; - - -TEST_F(TypeDictionaryTest, getDataType_1) { - - /* TypeDictionary::getDataType should return NULL if the specified - typeName is not defined in the TypeDictionary.*/ - - const DataType* dataType = typeDictionary->getDataType("non-existent-type"); - - EXPECT_EQ( NULL, dataType); -} - -TEST_F(TypeDictionaryTest, getDataType_2) { - - /* TypeDictionary should be pre-loaded with all of the builtin types */ - - const DataType* dataType; - - dataType = typeDictionary->getDataType("void"); - EXPECT_NE( (void*)NULL, dataType); - - dataType = typeDictionary->getDataType("char"); - EXPECT_NE( (void*)NULL, dataType); - - dataType = typeDictionary->getDataType("short"); - EXPECT_NE( (void*)NULL, dataType); - - dataType = typeDictionary->getDataType("int"); - EXPECT_NE( (void*)NULL, dataType); - - dataType = typeDictionary->getDataType("long"); - EXPECT_NE( (void*)NULL, dataType); - - dataType = typeDictionary->getDataType("wchar_t"); - EXPECT_NE( (void*)NULL, dataType); - - dataType = typeDictionary->getDataType("long long"); - EXPECT_NE( (void*)NULL, dataType); - - dataType = typeDictionary->getDataType("unsigned char"); - EXPECT_NE( (void*)NULL, dataType); - - dataType = typeDictionary->getDataType("unsigned short"); - EXPECT_NE( (void*)NULL, dataType); - - dataType = typeDictionary->getDataType("unsigned int"); - EXPECT_NE( (void*)NULL, dataType); - - dataType = typeDictionary->getDataType("unsigned long"); - EXPECT_NE( (void*)NULL, dataType); - - dataType = typeDictionary->getDataType("unsigned long long"); - EXPECT_NE( (void*)NULL, dataType); - - dataType = typeDictionary->getDataType("float"); - EXPECT_NE( (void*)NULL, dataType); - - dataType = typeDictionary->getDataType("double"); - EXPECT_NE( (void*)NULL, dataType); - -} - -TEST_F(TypeDictionaryTest, addTypeDefinition_1) { - - /* Should be able to add a pair (a type definition) to the TypeDictionary. */ - bool test_passed = true; - - CompositeDataType * compTypeSpec; - - try { - compTypeSpec = new CompositeDataType(typeDictionary, "ClassOne", sizeof(ClassOne), &construct, &destruct); - compTypeSpec->addRegularMember( "a", offsetof(ClassOne, a), "int", 0, NULL); - compTypeSpec->addRegularMember( "b", offsetof(ClassOne, b), "double", 0, NULL); - - typeDictionary->addTypeDefinition("ClassOne", compTypeSpec); - - } catch (std::logic_error e) { - std::cerr << e.what(); - test_passed = false; - } - - // Verify that addTypeDefinition didn't throw an exception. - EXPECT_EQ( true, test_passed); - - // Verify that the types can be validated. - test_passed = typeDictionary->validate(); - EXPECT_EQ( true, test_passed); - - // Verify that the correct DataType can be retrieved from the TypeDictionary by name. - const DataType* dataType = typeDictionary->getDataType("ClassOne"); - EXPECT_EQ( (void*)compTypeSpec, (void*)dataType); -} - -TEST_F(TypeDictionaryTest, addTypeDefinition_2) { - - /* An attempt to redefine a type should throw an exception. */ - - int test_result = 0; - - try { - typeDictionary->addTypeDefinition("char", new PrimitiveDataType() ); - } catch (std::logic_error e) { - std::cerr << "NOTE: Exception is expected as part of the test." << std::endl; - std::cerr << e.what() << std::endl; - test_result = 1; - } - - EXPECT_EQ( 1, test_result); -} - diff --git a/trick_source/sim_services/DataTypes/testing/makefile b/trick_source/sim_services/DataTypes/testing/makefile deleted file mode 100644 index c6ed1bb73..000000000 --- a/trick_source/sim_services/DataTypes/testing/makefile +++ /dev/null @@ -1,78 +0,0 @@ - -RM = rm -rf -CC = cc -CPP = /usr/bin/g++ - -DECL_DIR = .. - -GTEST_HOME=/usr/local -UNAME_S = $(shell uname -s) -UNAME_M = $(shell uname -m) -ifeq ($(UNAME_S),Darwin) - ifeq ($(UNAME_M),arm64) - GTEST_HOME=/opt/homebrew - endif -endif - -CFLAGS += -std=c++14 -g -Wall -Wextra -I$(GTEST_HOME)/include -I$(DECL_DIR)/include - -LIBS = -L${DECL_DIR}/lib -lDecl -L${GTEST_HOME}/lib -lgtest -lgtest_main -lpthread - -# TESTS = PrimTypeSpecTest CompTypeSpecTest TypeDictionaryTest EnumTypeSpecTest ArrayTypeSpecTest LexicalAnalyzerTest ParsedDeclarationTest AllocInfoTest ClassicChkPtAgentTest - -# ================================================================================== -# All tests produced by this Makefile. Add new tests you create to this list. -# ================================================================================== -TESTS = PrimTypeSpecTest \ - CompTypeSpecTest \ - TypeDictionaryTest \ - EnumTypeSpecTest \ - ArrayTypeSpecTest \ - LexicalAnalyzerTest \ - ParsedDeclarationTest \ - AllocInfoTest \ - ClassicChkPtAgentTest - -# List of XML files produced by the tests. -unittest_results = $(patsubst %,%.xml,$(TESTS)) - -# List if Test-specific object files. -unittest_objects = $(patsubst %,%.o,$(TESTS)) - -# ================================================================================== -# TARGETS -# ================================================================================== -all : test - -test: unit_tests $(unittest_results) - -unit_tests: $(TESTS) - -clean : - rm -f $(TESTS) - rm -f *.o - rm -f *.xml - -# ================================================================================== -# Generate JUNIT (XML) Test Results -# ================================================================================== -$(unittest_results): %.xml: % - ./$< --gtest_output=xml:$@ - -# ================================================================================== -# Build Unit test Objects -# ================================================================================== -$(unittest_objects): %.o: %.cpp - $(CPP) $(CFLAGS) -c $< - -DataTypeTestSupport.o : DataTypeTestSupport.cpp - $(CPP) $(CFLAGS) -c $< - -# ================================================================================== -# Build Unit test programs -# ================================================================================== -$(TESTS) : %: %.o - $(CPP) -o $@ $^ ${LIBS} - -CompTypeSpecTest : DataTypeTestSupport.o -ClassicChkPtAgentTest : DataTypeTestSupport.o