diff options
Diffstat (limited to 'src/boost/libs/icl/example/splititvmap_shell_')
-rw-r--r-- | src/boost/libs/icl/example/splititvmap_shell_/splititvmap_shell.cpp | 131 | ||||
-rw-r--r-- | src/boost/libs/icl/example/splititvmap_shell_/vc9_splititvmap_shell.vcproj | 214 |
2 files changed, 345 insertions, 0 deletions
diff --git a/src/boost/libs/icl/example/splititvmap_shell_/splititvmap_shell.cpp b/src/boost/libs/icl/example/splititvmap_shell_/splititvmap_shell.cpp new file mode 100644 index 000000000..549486da6 --- /dev/null +++ b/src/boost/libs/icl/example/splititvmap_shell_/splititvmap_shell.cpp @@ -0,0 +1,131 @@ +/*-----------------------------------------------------------------------------+ +Copyright (c) 2007-2009: Joachim Faulhaber ++------------------------------------------------------------------------------+ +Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin ++------------------------------------------------------------------------------+ + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENCE.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) ++-----------------------------------------------------------------------------*/ + +/*-----------------------------------------------------------------------------+ +splititvmap_shell.cpp provides a simple test shell for splitting interval maps. +The shell also gives you a good idea how interval container are working. ++-----------------------------------------------------------------------------*/ +#include <iostream> + +#include <boost/icl/split_interval_set.hpp> +#include <boost/icl/split_interval_map.hpp> +#include <boost/icl/interval_map.hpp> + +using namespace std; +using namespace boost; +using namespace boost::icl; + +void instructions() +{ + cout << "+++++ Test shell for split interval map +++++\n"; + cout << "Type: q e or 0 to quit\n"; + cout << "Type: + for insertions\n"; + cout << "Type: - for subtraction of ([a,b],value)\n"; + cout << "Type: _ for subtraction of [a,b]\n"; + cout << "Type: j to join contiguous intervals\n"; + cout << "Type: s to compute total size\n"; +} + +void wrongInput() +{ + cout << "Wrong Input ------------------\n"; + instructions(); +} + + +template <class MapTV> +void mapTestShell() +{ + MapTV m1; + + try { + char cmd = 'b'; + typename MapTV::domain_type + lwb = typename MapTV::domain_type(), + upb = typename MapTV::domain_type(); + + typename MapTV::codomain_type + val = typename MapTV::codomain_type(); + + instructions(); + + for(;;) + { + cout << "> "; + cin >> cmd ; + + switch(cmd) + { + case 'q': + case 'e': + case '0': cout << "good bye\n"; return; + case '+': + { + cout << "input: lwb upb val >> "; + cin >> lwb >> upb >> val; + typename MapTV::interval_type + itv = typename MapTV::interval_type(lwb,upb); + m1 += make_pair(itv,val); + + cout << "+" << itv << " " << val << " =" << endl; + cout << "{" << m1 << "}" << endl; + + } + break; + case '-': + { + cout << "input: lwb upb val >> "; + cin >> lwb >> upb >> val; + typename MapTV::interval_type + itv = typename MapTV::interval_type(lwb,upb); + m1 -= make_pair(itv,val); + + cout << "-" << itv << " " << val << " =" << endl; + cout << "{" << m1 << "}" << endl; + + } + break; + case 'j': + { + icl::join(m1); + cout << "{" << m1 << "}" << endl; + } + break; + case 's': + { + cout << "size = " << m1.size() << endl; + } + break; + + default: wrongInput(); + } + } // end while + } + catch (exception& e) + { + cout << "splititvmap_shell: exception caught: " << endl + << e.what() << endl; + } + catch (...) + { + cout << "splititvmap_shell: unknown exception caught" << endl; + } +} + + +int main() +{ + cout << ">>Interval Container Library: Test splititvmap_shell.cpp <<\n"; + cout << "-----------------------------------------------------------\n"; + mapTestShell< interval_map<int, int> >(); + + return 0; +} + diff --git a/src/boost/libs/icl/example/splititvmap_shell_/vc9_splititvmap_shell.vcproj b/src/boost/libs/icl/example/splititvmap_shell_/vc9_splititvmap_shell.vcproj new file mode 100644 index 000000000..c24c304c6 --- /dev/null +++ b/src/boost/libs/icl/example/splititvmap_shell_/vc9_splititvmap_shell.vcproj @@ -0,0 +1,214 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="vc9_splititvmap_shell" + ProjectGUID="{639F6AD9-CD50-40BF-92B9-CC9DD069D65A}" + RootNamespace="splititvmap_shell" + Keyword="Win32Proj" + TargetFrameworkVersion="131072" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="../../../../bin/debug" + IntermediateDirectory="../../../../bin/obj/$(ProjectName)/debug" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="../../../../" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="../../../../bin/Debug/$(ProjectName).exe" + LinkIncremental="2" + AdditionalLibraryDirectories="../../../../lib" + GenerateDebugInformation="true" + SubSystem="1" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="../../../../bin/release" + IntermediateDirectory="../../../../bin/obj/$(ProjectName)/release" + ConfigurationType="1" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="../../../../" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="../../../../bin/release/$(ProjectName).exe" + LinkIncremental="1" + AdditionalLibraryDirectories="../../../../lib" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\splititvmap_shell.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath="..\..\..\..\boost\itl\interval.hpp" + > + </File> + <File + RelativePath="..\..\..\..\boost\itl\split_interval_map.hpp" + > + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + <File + RelativePath=".\ReadMe.txt" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> |