diff options
Diffstat (limited to 'src/boost/libs/icl/example/party_')
-rw-r--r-- | src/boost/libs/icl/example/party_/party.cpp | 109 | ||||
-rw-r--r-- | src/boost/libs/icl/example/party_/vc10_party.vcxproj | 106 | ||||
-rw-r--r-- | src/boost/libs/icl/example/party_/vc10_party.vcxproj.filters | 27 | ||||
-rw-r--r-- | src/boost/libs/icl/example/party_/vc9_party.vcproj | 212 |
4 files changed, 454 insertions, 0 deletions
diff --git a/src/boost/libs/icl/example/party_/party.cpp b/src/boost/libs/icl/example/party_/party.cpp new file mode 100644 index 00000000..df660500 --- /dev/null +++ b/src/boost/libs/icl/example/party_/party.cpp @@ -0,0 +1,109 @@ +/*-----------------------------------------------------------------------------+ +Interval Container Library +Author: Joachim Faulhaber +Copyright (c) 2007-2010: 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) ++-----------------------------------------------------------------------------*/ +#include <iostream> +#include <boost/icl/interval_map.hpp> +#include "../toytime.hpp" + +using namespace std; +using namespace boost::icl; + +/** + Party.cpp demonstrates the possibilities of an interval map (interval_map or + split_interval_map). An interval_map maps intervals to a given content. In + this case the content is a set of party guests represented by their name + strings. + + As time goes by, groups of people join the party and leave later in the + evening. So we add a time interval and a name set to the interval_map for + the attendance of each group of people, that come together and leave + together. + + On every overlap of intervals, the corresponding name sets are accumulated. + At the points of overlap the intervals are split. The accumulation of content + on overlap of intervals is always done via an operator += that has to be + implemented for the content parameter of the interval_map. + + Finally the interval_map contains the history of attendance and all points + in time, where the group of party guests changed. + + Party.cpp demonstrates a principle that we call aggregate on overlap + (aggovering;) On insertion a value associated to the interval is aggregated + (added) to those values in the interval_map that overlap with the inserted + value. + + There are two behavioral aspects to aggovering: a decompositional behavior + and a accumulative behavior. + + The decompositional behavior splits up intervals on the time dimension of + the interval_map so that the intervals change whenever associated values + change. + + The accumulative behavior accumulates associated values on every overlap of + an insertion for the associated values. +*/ + +// Type set<string> collects the names of party guests. Since std::set is +// a model of the itl's set concept, the concept provides an operator += +// that performs a set union on overlap of intervals. +typedef std::set<string> GuestSetT; + +// 'Time' is the domain type the interval_map. It's key values are therefore +// time intervals. The content is the set of names: GuestSetT. + + +void party() +{ + GuestSetT mary_harry; + mary_harry.insert("Mary"); + mary_harry.insert("Harry"); + + GuestSetT diana_susan; + diana_susan.insert("Diana"); + diana_susan.insert("Susan"); + + GuestSetT peter; + peter.insert("Peter"); + + interval_map<Time, GuestSetT> party; + + party += make_pair( interval<Time>::right_open(Time(19,30), Time(23,00)), mary_harry); + party += make_pair( interval<Time>::right_open(Time(20,10), Time(monday,0,0)), diana_susan); + party += make_pair( interval<Time>::right_open(Time(22,15), Time(monday,0,30)), peter); + + interval_map<Time, GuestSetT>::iterator it = party.begin(); + while(it != party.end()) + { + discrete_interval<Time> when = it->first; + // Who is at the party within the time interval 'when' ? + GuestSetT who = (*it++).second; + cout << when << ": " << who << endl; + } +} + +int main() +{ + cout << ">>Interval Container Library: Sample party.cpp <<\n"; + cout << "-------------------------------------------------------\n"; + party(); + return 0; +} + +// Program output: + +// >>Interval Container Library: Sample party.cpp << +// ------------------------------------------------- +// [sun:19:30,sun:20:10): Harry Mary +// [sun:20:10,sun:22:15): Diana Harry Mary Susan +// [sun:22:15,sun:23:00): Diana Harry Mary Peter Susan +// [sun:23:00,mon:00:00): Diana Peter Susan +// [mon:00:00,mon:00:30): Peter + + diff --git a/src/boost/libs/icl/example/party_/vc10_party.vcxproj b/src/boost/libs/icl/example/party_/vc10_party.vcxproj new file mode 100644 index 00000000..1d6c16f9 --- /dev/null +++ b/src/boost/libs/icl/example/party_/vc10_party.vcxproj @@ -0,0 +1,106 @@ +<?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-AA054DD43759}</ProjectGuid> + <RootNamespace>Party</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;../../boost_1_35_0/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AssemblyDebug>true</AssemblyDebug> + <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;../../boost_1_35_0/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <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="party.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\..\boost\itl\interval_map.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/party_/vc10_party.vcxproj.filters b/src/boost/libs/icl/example/party_/vc10_party.vcxproj.filters new file mode 100644 index 00000000..b082c17e --- /dev/null +++ b/src/boost/libs/icl/example/party_/vc10_party.vcxproj.filters @@ -0,0 +1,27 @@ +<?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="party.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\..\boost\itl\interval_map.hpp"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/src/boost/libs/icl/example/party_/vc9_party.vcproj b/src/boost/libs/icl/example/party_/vc9_party.vcproj new file mode 100644 index 00000000..f5a1072f --- /dev/null +++ b/src/boost/libs/icl/example/party_/vc9_party.vcproj @@ -0,0 +1,212 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="vc9_party" + ProjectGUID="{DD9C9854-3882-42B9-BFA1-AA054DD43759}" + RootNamespace="Party" + 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" + UseUnicodeResponseFiles="true" + OutputFile="../../../../bin/debug/$(ProjectName).exe" + LinkIncremental="2" + AdditionalLibraryDirectories="../../../../lib;../../boost_1_35_0/lib" + IgnoreAllDefaultLibraries="false" + GenerateDebugInformation="true" + AssemblyDebug="1" + SubSystem="1" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + UseUnicodeResponseFiles="true" + /> + <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" + UseUnicodeResponseFiles="false" + OutputFile="../../../../bin/release/$(ProjectName).exe" + LinkIncremental="1" + AdditionalLibraryDirectories="../../../../lib;../../boost_1_35_0/lib" + IgnoreAllDefaultLibraries="false" + 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=".\party.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_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> + </Files> + <Globals> + </Globals> +</VisualStudioProject> |