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/interval_container_ | |
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/interval_container_')
4 files changed, 491 insertions, 0 deletions
diff --git a/src/boost/libs/icl/example/interval_container_/interval_container.cpp b/src/boost/libs/icl/example/interval_container_/interval_container.cpp new file mode 100644 index 00000000..0be197ad --- /dev/null +++ b/src/boost/libs/icl/example/interval_container_/interval_container.cpp @@ -0,0 +1,107 @@ +/*-----------------------------------------------------------------------------+ +Interval Container Library +Author: Joachim Faulhaber +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) ++-----------------------------------------------------------------------------*/ +/** Example interval_container.cpp \file interval_container.cpp + + \brief Demonstrates basic characteristics of interval container objects. + + \include interval_container_/interval_container.cpp +*/ +//[example_interval_container +#include <iostream> +#include <boost/icl/interval_set.hpp> +#include <boost/icl/separate_interval_set.hpp> +#include <boost/icl/split_interval_set.hpp> +#include <boost/icl/split_interval_map.hpp> +#include "../toytime.hpp" + +using namespace std; +using namespace boost::icl; + +void interval_container_basics() +{ + interval<Time>::type night_and_day(Time(monday, 20,00), Time(tuesday, 20,00)); + interval<Time>::type day_and_night(Time(tuesday, 7,00), Time(wednesday, 7,00)); + interval<Time>::type next_morning(Time(wednesday, 7,00), Time(wednesday,10,00)); + interval<Time>::type next_evening(Time(wednesday,18,00), Time(wednesday,21,00)); + + // An interval set of type interval_set joins intervals that that overlap or touch each other. + interval_set<Time> joinedTimes; + joinedTimes.insert(night_and_day); + joinedTimes.insert(day_and_night); //overlapping in 'day' [07:00, 20.00) + joinedTimes.insert(next_morning); //touching + joinedTimes.insert(next_evening); //disjoint + + cout << "Joined times :" << joinedTimes << endl; + + // A separate interval set of type separate_interval_set joins intervals that that + // overlap but it preserves interval borders that just touch each other. You may + // represent time grids like the months of a year as a split_interval_set. + separate_interval_set<Time> separateTimes; + separateTimes.insert(night_and_day); + separateTimes.insert(day_and_night); //overlapping in 'day' [07:00, 20.00) + separateTimes.insert(next_morning); //touching + separateTimes.insert(next_evening); //disjoint + + cout << "Separate times:" << separateTimes << endl; + + // A split interval set of type split_interval_set preserves all interval + // borders. On insertion of overlapping intervals the intervals in the + // set are split up at the interval borders of the inserted interval. + split_interval_set<Time> splitTimes; + splitTimes += night_and_day; + splitTimes += day_and_night; //overlapping in 'day' [07:00, 20:00) + splitTimes += next_morning; //touching + splitTimes += next_evening; //disjoint + + cout << "Split times :\n" << splitTimes << endl; + + // A split interval map splits up inserted intervals on overlap and aggregates the + // associated quantities via the operator += + split_interval_map<Time, int> overlapCounter; + overlapCounter += make_pair(night_and_day,1); + overlapCounter += make_pair(day_and_night,1); //overlapping in 'day' [07:00, 20.00) + overlapCounter += make_pair(next_morning, 1); //touching + overlapCounter += make_pair(next_evening, 1); //disjoint + + cout << "Split times overlap counted:\n" << overlapCounter << endl; + + // An interval map joins touching intervals, if associated values are equal + interval_map<Time, int> joiningOverlapCounter; + joiningOverlapCounter = overlapCounter; + cout << "Times overlap counted:\n" << joiningOverlapCounter << endl; +} + +int main() +{ + cout << ">>Interval Container Library: Sample interval_container.cpp <<\n"; + cout << "--------------------------------------------------------------\n"; + interval_container_basics(); + return 0; +} + + +// Program output: +/* ---------------------------------------------------------------------------- +>>Interval Container Library: Sample interval_container.cpp << +-------------------------------------------------------------- +Joined times :[mon:20:00,wed:10:00)[wed:18:00,wed:21:00) +Separate times:[mon:20:00,wed:07:00)[wed:07:00,wed:10:00)[wed:18:00,wed:21:00) +Split times : +[mon:20:00,tue:07:00)[tue:07:00,tue:20:00)[tue:20:00,wed:07:00) +[wed:07:00,wed:10:00)[wed:18:00,wed:21:00) +Split times overlap counted: +{([mon:20:00,tue:07:00)->1)([tue:07:00,tue:20:00)->2)([tue:20:00,wed:07:00)->1) +([wed:07:00,wed:10:00)->1)([wed:18:00,wed:21:00)->1)} +Times overlap counted: +{([mon:20:00,tue:07:00)->1)([tue:07:00,tue:20:00)->2)([tue:20:00,wed:10:00)->1) +([wed:18:00,wed:21:00)->1)} +-----------------------------------------------------------------------------*/ +//] diff --git a/src/boost/libs/icl/example/interval_container_/vc10_interval_container.vcxproj b/src/boost/libs/icl/example/interval_container_/vc10_interval_container.vcxproj new file mode 100644 index 00000000..ff76a883 --- /dev/null +++ b/src/boost/libs/icl/example/interval_container_/vc10_interval_container.vcxproj @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{DD9C9854-3882-42B9-BFA2-E91A07F9DD81}</ProjectGuid> + <RootNamespace>interval_container</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../../bin/debug/\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../../bin/obj/$(ProjectName)/debug/\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../../bin/release/\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../../bin/obj/$(ProjectName)/release/\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../../;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <OutputFile>../../../../bin/debug/$(ProjectName).exe</OutputFile> + <AdditionalLibraryDirectories>../../../../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <AdditionalIncludeDirectories>../../../../;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <OutputFile>../../../../bin/release/$(ProjectName).exe</OutputFile> + <AdditionalLibraryDirectories>../../../../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="interval_container.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\..\boost\itl\interval_base_map.hpp" /> + <ClInclude Include="..\..\..\..\boost\itl\interval_base_set.hpp" /> + <ClInclude Include="..\..\..\..\boost\itl\interval_map.hpp" /> + <ClInclude Include="..\..\..\..\boost\itl\interval_set.hpp" /> + <ClInclude Include="..\..\..\..\boost\itl\separate_interval_set.hpp" /> + <ClInclude Include="..\..\..\..\boost\itl\split_interval_map.hpp" /> + <ClInclude Include="..\..\..\..\boost\itl\split_interval_set.hpp" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/src/boost/libs/icl/example/interval_container_/vc10_interval_container.vcxproj.filters b/src/boost/libs/icl/example/interval_container_/vc10_interval_container.vcxproj.filters new file mode 100644 index 00000000..16d24297 --- /dev/null +++ b/src/boost/libs/icl/example/interval_container_/vc10_interval_container.vcxproj.filters @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="interval_container.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\..\boost\itl\interval_base_map.hpp"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\boost\itl\interval_base_set.hpp"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\boost\itl\interval_map.hpp"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\boost\itl\interval_set.hpp"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\boost\itl\separate_interval_set.hpp"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\boost\itl\split_interval_map.hpp"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\boost\itl\split_interval_set.hpp"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/src/boost/libs/icl/example/interval_container_/vc9_interval_container.vcproj b/src/boost/libs/icl/example/interval_container_/vc9_interval_container.vcproj new file mode 100644 index 00000000..8020e113 --- /dev/null +++ b/src/boost/libs/icl/example/interval_container_/vc9_interval_container.vcproj @@ -0,0 +1,230 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="vc9_interval_container" + ProjectGUID="{DD9C9854-3882-42B9-BFA1-E91A07F9DD81}" + RootNamespace="interval_container" + 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="4" + 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=".\interval_container.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_base_map.hpp" + > + </File> + <File + RelativePath="..\..\..\..\boost\itl\interval_base_set.hpp" + > + </File> + <File + RelativePath="..\..\..\..\boost\itl\interval_map.hpp" + > + </File> + <File + RelativePath="..\..\..\..\boost\itl\interval_set.hpp" + > + </File> + <File + RelativePath="..\..\..\..\boost\itl\separate_interval_set.hpp" + > + </File> + <File + RelativePath="..\..\..\..\boost\itl\split_interval_map.hpp" + > + </File> + <File + RelativePath="..\..\..\..\boost\itl\split_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> + </Files> + <Globals> + </Globals> +</VisualStudioProject> |