slice2freeze Command-Line Options
The Slice-to-Freeze compiler, slice2freeze
, generates C++ classes for Freeze maps and Freeze Evictor indices.
slice2freeze
's first command-line parameter is the base name for the generated C++ files, and not a Slice file like with the other Slice compilers:
slice2freeze [options] BaseName [SliceFile1 SliceFile2 ...]
The compiler offers the following command-line options in addition to the standard options:
--header-ext EXT
Changes the file extension for the generated header files from the default h
to the extension specified by EXT
.
--source-ext EXT
Changes the file extension for the generated source files from the default cpp
to the extension specified by EXT
.
--add-header HDR[,GUARD]
This option adds an include directive for the specified header at the beginning of the generated source file (preceding any other include directives). If GUARD
is specified, the include directive is protected by the specified guard.
For example:
--add-header precompiled.h,_PRECOMPILED_H__
results in the following directives at the beginning of the generated source file:
#ifndef __PRECOMPILED_H__ #define __PRECOMPILED_H__ #include <precompiled.h> #endif
As this example demonstrates, the --add-header
option is useful mainly for integrating the generated code with a compiler's precompiled header mechanism.
This option can be repeated to create include directives for several files.
--include-dir DIR
Modifies #include
directives in source files to prepend the path name of each header file with the directory DIR
. The discussion of slice2cpp
provides more information.
--dll-export SYMBOL
Use SYMBOL
to control DLL exports or imports. See the slice2cpp
description for details.
--dict NAME,KEY,VALUE[,sort[,COMPARE]]
Generate a Freeze map class named NAME
using KEY
as key and VALUE
as value. This option may be specified multiple times to generate several Freeze maps. NAME
may be a scoped C++ name, such as Demo::Struct1ObjectMap
. KEY
and VALUE
represent Slice types and therefore must use Slice syntax, such as bool
or Ice::Identity
. The type identified by KEY
must be a legal dictionary key type. By default, keys are sorted using their binary Ice-encoded representation. Include sort
to sort with the COMPARE
functor class. If COMPARE
is not specified, the default value is std::less<
KEY
>
.
--dict-index MAP[,MEMBER] [,case-sensitive|case-insensitive][,sort[,COMPARE]]
Add an index to the Freeze map named MAP
. If MEMBER
is specified, the map value type must be a structure or a class, and MEMBER
must be a member of this structure or class. Otherwise, the entire value is indexed. When the indexed member (or entire value) is a string, the index can be case-sensitive (default) or case-insensitive. An index adds additional member functions to the generated C++ map:
iterator findBy
MEMBER(MEMBER_TYPE, bool = true);
const_iterator findBy
MEMBER(MEMBER_TYPE,bool = true) const;
iterator beginFor
MEMBER();
const_iterator begin_For
MEMBER() const;
iterator endFor
MEMBER();
const_iterator endFor
MEMBER() const;
iterator lowerBoundFor
MEMBER(MEMBER_TYPE);
const_iterator lowerBoundFor
MEMBER(MEMBER_TYPE) const;
iterator upperBoundFor
MEMBER(MEMBER_TYPE);
const_iterator upperBoundFor
MEMBER(MEMBER_TYPE) const;
std::pair<iterator, iterator> equalRangeFor
MEMBER(MEMBER_TYPE);
std::pair<const_iterator, const_iterator> equalRangeFor
MEMBER(MEMBER_TYPE) const;
int MEMBER
Count(MEMBER_TYPE) const;
When MEMBER
is not specified, these functions are findByValue
(const and non-const), lowerBoundForValue
(const and non-const), valueCount
, and so on. When MEMBER
is specified, its first letter is capitalized in the findBy
function name. MEMBER_TYPE
corresponds to an in-parameter of the type of MEMBER
(or the type of the value when MEMBER
is not specified). For example, if MEMBER
is a string, MEMBER_TYPE
is a const std::string&
.
By default, keys are sorted using their binary Ice-encoded representation. Include sort
to sort with the COMPARE
functor class. If COMPARE
is not specified, the default value is std::less<
MEMBER_TYPE
>
.
findBy
MEMBER
returns an iterator to the first element in the Freeze map that matches the given index value. It returns end()
if there is no match. When the second parameter is true (the default), the returned iterator provides only the elements with an exact match (and then skips to end()
). Otherwise, the returned iterator sets a starting position and then provides all elements until the end of the map, sorted according to the index comparator.
lowerBoundFor
MEMBER
returns an iterator to the first element in the Freeze map whose index value is not less than the given index value. It returns end()
if there is no such element. The returned iterator provides all elements until the end of the map, sorted according to the index comparator.
upperBoundFor
MEMBER
returns an iterator to the first element in the Freeze map whose index value is greater than the given index value. It returns end()
if there is no such element. The returned iterator provides all elements until the end of the map, sorted according to the index comparator.
beginFor
MEMBER
returns an iterator to the first element in the map.
endFor
MEMBER
returns an iterator to the last element in the map.
equalRangeFor
MEMBER
returns a range (pair of iterators) of all the elements whose index value matches the given index value. This function is similar to findByMEMBER
(see above).
MEMBER
Count
returns the number of elements in the Freeze map whose index value matches the given index value.
Please note that index-derived iterators do not allow you to set new values in the underlying map.
--index CLASS,TYPE,MEMBER [,case-sensitive|case-insensitive]
Generate an index class for a Freeze evictor. CLASS
is the name of the class to be generated. TYPE
denotes the type of class to be indexed (objects of different classes are not included in this index). MEMBER
is the name of the data member in TYPE
to index. When MEMBER
has type string
, it is possible to specify whether the index is case-sensitive or not. The default is case-sensitive.