diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/icl/example/itvset_shell_ | |
parent | Initial commit. (diff) | |
download | ceph-upstream.tar.xz ceph-upstream.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/icl/example/itvset_shell_')
-rw-r--r-- | src/boost/libs/icl/example/itvset_shell_/itvset_shell.cpp | 132 | ||||
-rw-r--r-- | src/boost/libs/icl/example/itvset_shell_/vc9_itvset_shell.vcproj | 214 |
2 files changed, 346 insertions, 0 deletions
diff --git a/src/boost/libs/icl/example/itvset_shell_/itvset_shell.cpp b/src/boost/libs/icl/example/itvset_shell_/itvset_shell.cpp new file mode 100644 index 00000000..553678d7 --- /dev/null +++ b/src/boost/libs/icl/example/itvset_shell_/itvset_shell.cpp @@ -0,0 +1,132 @@ +/*-----------------------------------------------------------------------------+ +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) ++-----------------------------------------------------------------------------*/ + +/*-----------------------------------------------------------------------------+ +itvset_shell.cpp provides a simple test shells for interval sets. +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> + +using namespace std; +using namespace boost; +using namespace boost::icl; + +void instructions() +{ + cout << "+++++ Test shell for interval set +++++\n"; + cout << "Type: q e or 0 to quit\n"; + cout << "Type: + for insertions\n"; + cout << "Type: - for subtraction\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 SetTV> +void setTestShell() +{ + SetTV m1; + + try { + char cmd = 'b'; + typename SetTV::domain_type lwb = typename SetTV::domain_type(); + typename SetTV::domain_type upb = typename SetTV::domain_type(); + + instructions(); + + for(;;) + { + cout << "> "; + cin >> cmd ; + + switch(cmd) + { + case 'q': + case 'e': + case '0': cout << "good bye\n"; return; + case '+': + { + cout << "input: lwb upb >> "; + cin >> lwb >> upb; + typename SetTV::interval_type itv + = typename SetTV::interval_type(lwb,upb); + // SetTV::IntervalTD itv = rightOpenInterval(lwb,upb); + m1.insert(itv); + + cout << "+" << itv << " =" << endl; + cout << "{" << m1 << "}" << endl; + + } + break; + case '-': + { + cout << "input: lwb upb >> "; + cin >> lwb >> upb; + typename SetTV::interval_type itv + = typename SetTV::interval_type(lwb,upb); + // m1.subtract(itv); + SetTV tmp; + tmp.insert(itv); + m1 -= tmp; + + cout << "-" << itv << " =" << endl; + cout << "{" << m1 << "}" << endl; + + } + break; + case 'j': + { + icl::join(m1); + cout << "{" << m1 << "}" << endl; + } + break; + case 's': + { + cout << "size = " << m1.size() << endl; + } + break; + + default: wrongInput(); + } + } + + } + catch (exception& e) + { + cout << "itvset_shell: exception caught: " << endl + << e.what() << endl; + } + catch (...) + { + cout << "itvset_shell: unknown exception caught" << endl; + } +} + + + + +int main() +{ + cout << ">>Interval Container Library: Test itvset_shell.cpp <<\n"; + cout << "------------------------------------------------------\n"; + setTestShell< interval_set<int> >(); + + return 0; +} + diff --git a/src/boost/libs/icl/example/itvset_shell_/vc9_itvset_shell.vcproj b/src/boost/libs/icl/example/itvset_shell_/vc9_itvset_shell.vcproj new file mode 100644 index 00000000..c301ad4a --- /dev/null +++ b/src/boost/libs/icl/example/itvset_shell_/vc9_itvset_shell.vcproj @@ -0,0 +1,214 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="vc9_itvset_shell" + ProjectGUID="{FC32CF3E-293A-4576-A5C2-9373AECAF5BB}" + RootNamespace="vc9_itvset_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=".\itvset_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\interval_set.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> |