From: <ric...@us...> - 2008-07-23 02:12:09
|
Revision: 870 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=870&view=rev Author: rich_sposato Date: 2008-07-23 02:12:05 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Adding MSVC 8 files to Loki. Added Paths: ----------- trunk/Loki_MSVC_8.sln trunk/src/Library_MSVC_8.vcproj trunk/test/CachedFactory/CachedFactory_MSVC_8.vcproj trunk/test/CheckReturn/CheckReturn_MSVC_8.vcproj trunk/test/DeletableSingleton/DeletableSingleton_MSVC_8.vcproj trunk/test/Factory/Factory_MSVC_8.vcproj trunk/test/Function/Function_MSVC_8.vcproj trunk/test/LockingPtr/LockingPtr_MSVC_8.vcproj trunk/test/Longevity/Longevity_MSVC_8.vcproj trunk/test/OrderedStatic/OrderedStatic_MSVC_8.vcproj trunk/test/Pimpl/Pimpl_MSVC_8.vcproj trunk/test/RegressionTest/MSVCUnitTest_MSVC_8.vcproj trunk/test/SafeFormat/SafeFormat_MSVC_8.vcproj trunk/test/ScopeGuard/ScopeGuard_MSVC_8.vcproj trunk/test/Singleton/Singleton_MSVC_8.vcproj trunk/test/SmallObj/DefaultAlloc_MSVC_8.vcproj trunk/test/SmallObj/SmallObjCompare_MSVC_8.vcproj trunk/test/SmallObj/SmallObjSingleton_MSVC_8.vcproj trunk/test/SmartPtr/SmartPtr_MSVC_8.vcproj trunk/test/Visitor/Visitor_MSVC_8.vcproj trunk/test/flex_string/flex_string_MSVC_8.vcproj Added: trunk/Loki_MSVC_8.sln =================================================================== --- trunk/Loki_MSVC_8.sln (rev 0) +++ trunk/Loki_MSVC_8.sln 2008-07-23 02:12:05 UTC (rev 870) @@ -0,0 +1,152 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Library", "src\library_MSVC_8.vcproj", "{CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Factory", "test\Factory\Factory_MSVC_8.vcproj", "{925D5863-2F77-41B7-96F1-CC814762C40F}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Longevity", "test\Longevity\Longevity_MSVC_8.vcproj", "{1333D945-B228-4845-9C91-C1B67AEEAED5}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OrderedStatic", "test\OrderedStatic\OrderedStatic_MSVC_8.vcproj", "{0DCBE03A-DAC7-4669-B29B-102D8F563736}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SafeFormat", "test\SafeFormat\SafeFormat_MSVC_8.vcproj", "{C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ScopeGuard", "test\ScopeGuard\ScopeGuard_MSVC_8.vcproj", "{D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Singleton", "test\Singleton\Singleton_MSVC_8.vcproj", "{9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Visitor", "test\Visitor\Visitor_MSVC_8.vcproj", "{0A696379-10A2-43FB-A26C-B42456FCF657}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flex_string", "test\flex_string\flex_string_MSVC_8.vcproj", "{2022B9AD-34CA-4FDA-80C2-42805FABE65B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmallObjCompare", "test\SmallObj\SmallObjCompare_MSVC_8.vcproj", "{0A98B714-818C-4DD3-A07C-BDD16399F362}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmallObjSingleton", "test\SmallObj\SmallObjSingleton_MSVC_8.vcproj", "{78536B46-8307-4AE5-933E-0CADE2887AFB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DeletableSingleton", "test\DeletableSingleton\DeletableSingleton_MSVC_8.vcproj", "{B87B3522-7DAA-400D-A47D-A74B9B8B3552}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DefaultAlloc", "test\SmallObj\DefaultAlloc_MSVC_8.vcproj", "{D490B134-B794-42CF-8AF8-9FDA524B9D3B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmartPtr", "test\SmartPtr\SmartPtr_MSVC_8.vcproj", "{D7AB4FEF-E7AF-443D-93A5-37F323F2042D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSVCUnitTest", "test\RegressionTest\MSVCUnitTest_MSVC_8.vcproj", "{79729949-F144-4098-BFE9-B6320E6AC3F6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Pimpl", "test\Pimpl\Pimpl_MSVC_8.vcproj", "{21D2B291-80F4-476C-A643-B8A7034DF95F}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LockingPtr", "test\LockingPtr\LockingPtr_MSVC_8.vcproj", "{25766C3F-C0D8-429F-A212-5FA3537B3E1C}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Function", "test\Function\Function_MSVC_8.vcproj", "{2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CachedFactory", "test\CachedFactory\CachedFactory_MSVC_8.vcproj", "{8D186AB4-E544-42D6-B192-1AE2C946875E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CheckReturn", "test\CheckReturn\CheckReturn_MSVC_8.vcproj", "{C0826A05-9143-4545-B5DE-811C188CB54E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Debug|Win32.ActiveCfg = Debug|Win32 + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Debug|Win32.Build.0 = Debug|Win32 + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release|Win32.ActiveCfg = Release|Win32 + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release|Win32.Build.0 = Release|Win32 + {925D5863-2F77-41B7-96F1-CC814762C40F}.Debug|Win32.ActiveCfg = Debug|Win32 + {925D5863-2F77-41B7-96F1-CC814762C40F}.Debug|Win32.Build.0 = Debug|Win32 + {925D5863-2F77-41B7-96F1-CC814762C40F}.Release|Win32.ActiveCfg = Release|Win32 + {925D5863-2F77-41B7-96F1-CC814762C40F}.Release|Win32.Build.0 = Release|Win32 + {1333D945-B228-4845-9C91-C1B67AEEAED5}.Debug|Win32.ActiveCfg = Debug|Win32 + {1333D945-B228-4845-9C91-C1B67AEEAED5}.Debug|Win32.Build.0 = Debug|Win32 + {1333D945-B228-4845-9C91-C1B67AEEAED5}.Release|Win32.ActiveCfg = Release|Win32 + {1333D945-B228-4845-9C91-C1B67AEEAED5}.Release|Win32.Build.0 = Release|Win32 + {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Debug|Win32.ActiveCfg = Debug|Win32 + {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Debug|Win32.Build.0 = Debug|Win32 + {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Release|Win32.ActiveCfg = Release|Win32 + {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Release|Win32.Build.0 = Release|Win32 + {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Debug|Win32.ActiveCfg = Debug|Win32 + {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Debug|Win32.Build.0 = Debug|Win32 + {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Release|Win32.ActiveCfg = Release|Win32 + {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Release|Win32.Build.0 = Release|Win32 + {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Debug|Win32.ActiveCfg = Debug|Win32 + {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Debug|Win32.Build.0 = Debug|Win32 + {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Release|Win32.ActiveCfg = Release|Win32 + {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Release|Win32.Build.0 = Release|Win32 + {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Debug|Win32.ActiveCfg = Debug|Win32 + {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Debug|Win32.Build.0 = Debug|Win32 + {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Release|Win32.ActiveCfg = Release|Win32 + {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Release|Win32.Build.0 = Release|Win32 + {0A696379-10A2-43FB-A26C-B42456FCF657}.Debug|Win32.ActiveCfg = Debug|Win32 + {0A696379-10A2-43FB-A26C-B42456FCF657}.Debug|Win32.Build.0 = Debug|Win32 + {0A696379-10A2-43FB-A26C-B42456FCF657}.Release|Win32.ActiveCfg = Release|Win32 + {0A696379-10A2-43FB-A26C-B42456FCF657}.Release|Win32.Build.0 = Release|Win32 + {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Debug|Win32.ActiveCfg = Debug|Win32 + {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Debug|Win32.Build.0 = Debug|Win32 + {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Release|Win32.ActiveCfg = Release|Win32 + {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Release|Win32.Build.0 = Release|Win32 + {0A98B714-818C-4DD3-A07C-BDD16399F362}.Debug|Win32.ActiveCfg = Debug|Win32 + {0A98B714-818C-4DD3-A07C-BDD16399F362}.Debug|Win32.Build.0 = Debug|Win32 + {0A98B714-818C-4DD3-A07C-BDD16399F362}.Release|Win32.ActiveCfg = Release|Win32 + {0A98B714-818C-4DD3-A07C-BDD16399F362}.Release|Win32.Build.0 = Release|Win32 + {78536B46-8307-4AE5-933E-0CADE2887AFB}.Debug|Win32.ActiveCfg = Debug|Win32 + {78536B46-8307-4AE5-933E-0CADE2887AFB}.Debug|Win32.Build.0 = Debug|Win32 + {78536B46-8307-4AE5-933E-0CADE2887AFB}.Release|Win32.ActiveCfg = Release|Win32 + {78536B46-8307-4AE5-933E-0CADE2887AFB}.Release|Win32.Build.0 = Release|Win32 + {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Debug|Win32.ActiveCfg = Debug|Win32 + {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Debug|Win32.Build.0 = Debug|Win32 + {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Release|Win32.ActiveCfg = Release|Win32 + {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Release|Win32.Build.0 = Release|Win32 + {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Debug|Win32.ActiveCfg = Debug|Win32 + {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Debug|Win32.Bild.0 = Debug|Win32 + {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Release|Win32.ActiveCfg = Release|Win32 + {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Release|Win32.Build.0 = Release|Win32 + {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Debug|Win32.ActiveCfg = Debug|Win32 + {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Debug|Win32.Build.0 = Debug|Win32 + {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Release|Win32.ActiveCfg = Release|Win32 + {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Release|Win32.Build.0 = Release|Win32 + {79729949-F144-4098-BFE9-B6320E6AC3F6}.Debug|Win32.ActiveCfg = Debug|Win32 + {79729949-F144-4098-BFE9-B6320E6AC3F6}.Debug|Win32.Build.0 = Debug|Win32 + {79729949-F144-4098-BFE9-B6320E6AC3F6}.Release|Win32.ActiveCfg = Release|Win32 + {79729949-F144-4098-BFE9-B6320E6AC3F6}.Release|Win32.Build.0 = Release|Win32 + {21D2B291-80F4-476C-A643-B8A7034DF95F}.Debug|Win32.ActiveCfg = Debug|Win32 + {21D2B291-80F4-476C-A643-B8A7034DF95F}.Debug|Win32.Build.0 = Debug|Win32 + {21D2B291-80F4-476C-A643-B8A7034DF95F}.Release|Win32.ActiveCfg = Release|Win32 + {21D2B291-80F4-476C-A643-B8A7034DF95F}.Release|Win32.Build.0 = Release|Win32 + {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Debug|Win32.ActiveCfg = Debug|Win32 + {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Debug|Win32.Build.0 = Debug|Win32 + {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Release|Win32.ActiveCfg = Release|Win32 + {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Release|Win32.Build.0 = Release|Win32 + {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Debug|Win32.ActiveCfg = Debug|Win32 + {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Debug|Win32.Build.0 = Debug|Win32 + {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Release|Win32.ActiveCfg = Release|Win32 + {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Release|Win32.Build.0 = Release|Win32 + {8D186AB4-E544-42D6-B192-1AE2C946875E}.Debug|Win32.ActiveCfg = Debug|Win32 + {8D186AB4-E544-42D6-B192-1AE2C946875E}.Debug|Win32.Build.0 = Debug|Win32 + {8D186AB4-E544-42D6-B192-1AE2C946875E}.Release|Win32.ActiveCfg = Release|Win32 + {8D186AB4-E544-42D6-B192-1AE2C946875E}.Release|Win32.Build.0 = Release|Win32 + {C0826A05-9143-4545-B5DE-811C188CB54E}.Debug|Win32.ActiveCfg = Debug|Win32 + {C0826A05-9143-4545-B5DE-811C188CB54E}.Debug|Win32.Build.0 = Debug|Win32 + {C0826A05-9143-4545-B5DE-811C188CB54E}.Release|Win32.ActiveCfg = Release|Win32 + {C0826A05-9143-4545-B5DE-811C188CB54E}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Added: trunk/src/Library_MSVC_8.vcproj =================================================================== --- trunk/src/Library_MSVC_8.vcproj (rev 0) +++ trunk/src/Library_MSVC_8.vcproj 2008-07-23 02:12:05 UTC (rev 870) @@ -0,0 +1,351 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="Library" + ProjectGUID="{CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}" + RootNamespace="Library" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="4" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="-wd4996" + Optimization="0" + AdditionalIncludeDirectories="..\include" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE _SECURE_SCL=1" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="../lib/loki_D.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="4" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="..\include" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="../lib/loki.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath="..\include\loki\AbstractFactory.h" + > + </File> + <File + RelativePath="..\include\loki\AssocVector.h" + > + </File> + <File + RelativePath="..\include\loki\ConstPolicy.h" + > + </File> + <File + RelativePath="..\include\loki\DataGenerators.h" + > + </File> + <File + RelativePath="..\include\loki\EmptyType.h" + > + </File> + <File + RelativePath="..\include\loki\Factory.h" + > + </File> + <File + RelativePath="..\include\loki\Function.h" + > + </File> + <File + RelativePath="..\include\loki\Functor.h" + > + </File> + <File + RelativePath="..\include\loki\HierarchyGenerators.h" + > + </File> + <File + RelativePath="..\include\loki\LockingPtr.h" + > + </File> + <File + RelativePath="..\include\loki\LokiExport.h" + > + </File> + <File + RelativePath="..\include\loki\LokiTypeInfo.h" + > + </File> + <File + RelativePath="..\include\loki\MultiMethods.h" + > + </File> + <File + RelativePath="..\include\loki\NullType.h" + > + </File> + <File + RelativePath="..\include\loki\OrderedStatic.h" + > + </File> + <File + RelativePath="..\include\loki\Pimpl.h" + > + </File> + <File + RelativePath="..\include\loki\RefToValue.h" + > + </File> + <File + RelativePath="..\include\loki\SafeFormat.h" + > + </File> + <File + RelativePath="..\include\loki\ScopeGuard.h" + > + </File> + <File + RelativePath="..\include\loki\Sequence.h" + > + </File> + <File + RelativePath="..\include\loki\Singleton.h" + > + </File> + <File + RelativePath="..\include\loki\SmallObj.h" + > + </File> + <File + RelativePath="..\include\loki\SmartPtr.h" + > + </File> + <File + RelativePath="..\include\loki\static_check.h" + > + </File> + <File + RelativePath="..\include\loki\StrongPtr.h" + > + </File> + <File + RelativePath="..\include\loki\Threads.h" + > + </File> + <File + RelativePath="..\include\loki\Tuple.h" + > + </File> + <File + RelativePath="..\include\loki\Typelist.h" + > + </File> + <File + RelativePath="..\include\loki\TypelistMacros.h" + > + </File> + <File + RelativePath="..\include\loki\TypeManip.h" + > + </File> + <File + RelativePath="..\include\loki\TypeTraits.h" + > + </File> + <File + RelativePath="..\include\loki\Visitor.h" + > + </File> + <Filter + Name="flexstring" + > + <File + RelativePath="..\loki\include\loki\flex\allocatorstringstorage.h" + > + </File> + <File + RelativePath="..\loki\include\loki\flex\cowstringopt.h" + > + </File> + <File + RelativePath="..\loki\include\loki\flex\flex_string.h" + > + </File> + <File + RelativePath="..\loki\include\loki\flex\flex_string_details.h" + > + </File> + <File + RelativePath="..\loki\include\loki\flex\flex_string_shell.h" + > + </File> + <File + RelativePath="..\loki\include\loki\flex\simplestringstorage.h" + > + </File> + <File + RelativePath="..\loki\include\loki\flex\smallstringopt.h" + > + </File> + <File + RelativePath="..\loki\include\loki\flex\vectorstringstorage.h" + > + </File> + </Filter> + </Filter> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\OrderedStatic.cpp" + > + </File> + <File + RelativePath=".\SafeFormat.cpp" + > + </File> + <File + RelativePath=".\Singleton.cpp" + > + </File> + <File + RelativePath=".\SmallObj.cpp" + > + </File> + <File + RelativePath=".\SmartPtr.cpp" + > + </File> + <File + RelativePath=".\StrongPtr.cpp" + > + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: trunk/test/CachedFactory/CachedFactory_MSVC_8.vcproj =================================================================== --- trunk/test/CachedFactory/CachedFactory_MSVC_8.vcproj (rev 0) +++ trunk/test/CachedFactory/CachedFactory_MSVC_8.vcproj 2008-07-23 02:12:05 UTC (rev 870) @@ -0,0 +1,194 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="CachedFactory" + ProjectGUID="{8D186AB4-E544-42D6-B192-1AE2C946875E}" + RootNamespace="CachedFactory" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="-wd4996" + Optimization="0" + AdditionalIncludeDirectories="..\..\include" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE _SECURE_SCL=1" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="..\..\include" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath="..\..\include\loki\CachedFactory.h" + > + </File> + <File + RelativePath=".\CachedFactoryTest.cpp" + > + </File> + <File + RelativePath="..\..\include\loki\Key.h" + > + </File> + <File + RelativePath="..\..\src\Singleton.cpp" + > + </File> + <File + RelativePath="..\..\src\SmallObj.cpp" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: trunk/test/CheckReturn/CheckReturn_MSVC_8.vcproj =================================================================== --- trunk/test/CheckReturn/CheckReturn_MSVC_8.vcproj (rev 0) +++ trunk/test/CheckReturn/CheckReturn_MSVC_8.vcproj 2008-07-23 02:12:05 UTC (rev 870) @@ -0,0 +1,198 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="CheckReturn" + ProjectGUID="{C0826A05-9143-4545-B5DE-811C188CB54E}" + RootNamespace="CheckReturn" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + 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="..\..\include" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + StringPooling="true" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + 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="..\..\include" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="0" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <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=".\main.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath="..\..\include\loki\CheckReturn.h" + > + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: trunk/test/DeletableSingleton/DeletableSingleton_MSVC_8.vcproj =================================================================== --- trunk/test/DeletableSingleton/DeletableSingleton_MSVC_8.vcproj (rev 0) +++ trunk/test/DeletableSingleton/DeletableSingleton_MSVC_8.vcproj 2008-07-23 02:12:05 UTC (rev 870) @@ -0,0 +1,168 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="DeletableSingleton" + ProjectGUID="{B87B3522-7DAA-400D-A47D-A74B9B8B3552}" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="..\..\include" + WarningLevel="4" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="..\..\include" + RuntimeLibrary="2" + WarningLevel="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\DeletableSingleton.cpp" + > + </File> + <File + RelativePath="..\..\src\Singleton.cpp" + > + </File> + <File + RelativePath="..\..\include\loki\Singleton.h" + > + </File> + <File + RelativePath="..\..\include\loki\Threads.h" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: trunk/test/Factory/Factory_MSVC_8.vcproj =================================================================== --- trunk/test/Factory/Factory_MSVC_8.vcproj (rev 0) +++ trunk/test/Factory/Factory_MSVC_8.vcproj 2008-07-23 02:12:05 UTC (rev 870) @@ -0,0 +1,186 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="Factory" + ProjectGUID="{925D5863-2F77-41B7-96F1-CC814762C40F}" + RootNamespace="Factory" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="-wd4996" + Optimization="0" + AdditionalIncludeDirectories="..\..\include" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE _SECURE_SCL=1" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="..\..\include" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\Factory.cpp" + > + </File> + <File + RelativePath="..\..\include\loki\Factory.h" + > + </File> + <File + RelativePath="..\..\include\loki\Functor.h" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: trunk/test/Function/Function_MSVC_8.vcproj =================================================================== --- trunk/test/Function/Function_MSVC_8.vcproj (rev 0) +++ trunk/test/Function/Function_MSVC_8.vcproj 2008-07-23 02:12:05 UTC (rev 870) @@ -0,0 +1,339 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="Function" + ProjectGUID="{2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}" + RootNamespace="Function" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="-wd4996" + Optimization="0" + AdditionalIncludeDirectories="..\..\include;c:\sandbox\boost\" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE _SECURE_SCL=1" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="..\..\include" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="more headers" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath="..\..\include\loki\AbstractFunction.h" + > + </File> + <File + RelativePath="..\..\include\loki\AssocVector.h" + > + </File> + <File + RelativePath="..\..\include\loki\DataGenerators.h" + > + </File> + <File + RelativePath="..\..\include\loki\EmptyType.h" + > + </File> + <File + RelativePath="..\..\include\loki\Function.h" + > + </File> + <File + RelativePath="..\..\include\loki\HierarchyGenerators.h" + > + </File> + <File + RelativePath="..\..\include\loki\LockingPtr.h" + > + </File> + <File + RelativePath="..\..\include\loki\LokiTypeInfo.h" + > + </File> + <File + RelativePath="..\..\include\loki\MultiMethods.h" + > + </File> + <File + RelativePath="..\..\include\loki\NullType.h" + > + </File> + <File + RelativePath="..\..\include\loki\OrderedStatic.h" + > + </File> + <File + RelativePath="..\..\include\loki\SafeFormat.h" + > + </File> + <File + RelativePath="..\..\include\loki\ScopeGuard.h" + > + </File> + <File + RelativePath="..\..\include\loki\Sequence.h" + > + </File> + <File + RelativePath="..\..\include\loki\Singleton.h" + > + </File> + <File + RelativePath="..\..\include\loki\SmallObj.h" + > + </File> + <File + RelativePath="..\..\include\loki\SmartPtr.h" + > + </File> + <File + RelativePath="..\..\include\loki\static_check.h" + > + </File> + <File + RelativePath="..\..\include\loki\Threads.h" + > + </File> + <File + RelativePath="..\..\include\loki\Tuple.h" + > + </File> + <File + RelativePath="..\..\include\loki\Typelist.h" + > + </File> + <File + RelativePath="..\..\include\loki\TypelistMacros.h" + > + </File> + <File + RelativePath="..\..\include\loki\TypeManip.h" + > + </File> + <File + RelativePath="..\..\include\loki\TypeTraits.h" + > + </File> + <File + RelativePath="..\..\include\loki\Visitor.h" + > + </File> + <Filter + Name="flexstring" + > + <File + RelativePath="..\..\include\loki\flex\allocatorstringstorage.h" + > + </File> + <File + RelativePath="..\..\include\loki\flex\cowstringopt.h" + > + </File> + <File + RelativePath="..\..\include\loki\flex\flex_string.h" + > + </File> + <File + RelativePath="..\..\include\loki\flex\flex_string_details.h" + > + </File> + <File + RelativePath="..\..\include\loki\flex\flex_string_shell.h" + > + </File> + <File + RelativePath="..\..\include\loki\flex\simplestringstorage.h" + > + </File> + <File + RelativePath="..\..\include\loki\flex\smallstringopt.h" + > + </File> + <File + RelativePath="..\..\include\loki\flex\vectorstringstorage.h" + > + </File> + </Filter> + </Filter> + <Filter + Name="src" + > + <File + RelativePath="..\..\src\Singleton.cpp" + > + </File> + <File + RelativePath="..\..\src\SmallObj.cpp" + > + </File> + </Filter> + <File + RelativePath="..\..\include\loki\Function.h" + > + </File> + <File + RelativePath=".\FunctionTest.cpp" + > + </File> + <File + RelativePath="..\..\include\loki\Functor.h" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: trunk/test/LockingPtr/LockingPtr_MSVC_8.vcproj =================================================================== --- trunk/test/LockingPtr/LockingPtr_MSVC_8.vcproj (rev 0) +++ trunk/test/LockingPtr/LockingPtr_MSVC_8.vcproj 2008-07-23 02:12:05 UTC (rev 870) @@ -0,0 +1,196 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="LockingPtr" + ProjectGUID="{25766C3F-C0D8-429F-A212-5FA3537B3E1C}" + RootNamespace="LockingPtr" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="-wd4996" + Optimization="0" + AdditionalIncludeDirectories="..\..\include;c:\sandbox\boost" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE _SECURE_SCL=1" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalLibraryDirectories="..\..\lib" + GenerateDebugInformation="true" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="..\..\include" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="..\..\lib\loki.lib" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath="..\..\include\loki\ConstPolicy.h" + > + </File> + <File + RelativePath="..\..\include\loki\LockingPtr.h" + > + </File> + <File + RelativePath=".\main.cpp" + > + </File> + <File + RelativePath=".\Thread.h" + > + </File> + <File + RelativePath="..\..\include\loki\Threads.h" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: trunk/test/Longevity/Longevity_MSVC_8.vcproj =================================================================== --- trunk/test/Longevity/Longevity_MSVC_8.vcproj (rev 0) +++ trunk/test/Longevity/Longevity_MSVC_8.vcproj 2008-07-23 02:12:05 UTC (rev 870) @@ -0,0 +1,186 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="Longevity" + ProjectGUID="{1333D945-B228-4845-9C91-C1B67AEEAED5}" + RootNamespace="Longevity" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="-wd4996" + Optimization="0" + AdditionalIncludeDirectories="..\..\include" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE _SECURE_SCL=1" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="..\..\include" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\main.cpp" + > + </File> + <File + RelativePath="..\..\src\Singleton.cpp" + > + </File> + <File + RelativePath="..\..\include\loki\Singleton.h" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: trunk/test/OrderedStatic/OrderedStatic_MSVC_8.vcproj =================================================================== --- trunk/test/OrderedStatic/OrderedStatic_MSVC_8.vcproj (rev 0) +++ trunk/test/OrderedStatic/OrderedStatic_MSVC_8.vcproj 2008-07-23 02:12:05 UTC (rev 870) @@ -0,0 +1,186 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="OrderedStatic" + ProjectGUID="{0DCBE03A-DAC7-4669-B29B-102D8F563736}" + RootNamespace="OrderedStatic" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="-wd4996" + Optimization="0" + AdditionalIncludeDirectories="..\..\include" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE _SECURE_SCL=1" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="..\..\include" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\main.cpp" + > + </File> + <File + RelativePath="..\..\src\OrderedStatic.cpp" + > + </File> + <File + RelativePath="..\..\include\loki\OrderedStatic.h" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: trunk/test/Pimpl/Pimpl_MSVC_8.vcproj =================================================================== --- trunk/test/Pimpl/Pimpl_MSVC_8.vcproj (rev 0) +++ trunk/test/Pimpl/Pimpl_MSVC_8.vcproj 2008-07-23 02:12:05 UTC (rev 870) @@ -0,0 +1,192 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="Pimpl" + ProjectGUID="{21D2B291-80F4-476C-A643-B8A7034DF95F}" + RootNamespace="Pimpl" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="-wd4996" + Optimization="0" + AdditionalIncludeDirectories="..\..\include;c:\sandbox\boost" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE _SECURE_SCL=1" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalLibraryDirectories="..\..\lib" + GenerateDebugInformation="true" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="..\..\include" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="..\..\lib\loki.lib" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\main.cpp" + > + </File> + <File + RelativePath="..\..\include\loki\Pimpl.h" + > + </File> + <File + RelativePath=".\type.h" + > + </File> + <File + RelativePath=".\type2.h" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: trunk/test/RegressionTest/MSVCUnitTest_MSVC_8.vcproj =================================================================== --- trunk/test/RegressionTest/MSVCUnitTest_MSVC_8.vcproj (rev 0) +++ trunk/test/RegressionTest/MSVCUnitTest_MSVC_8.vcproj 2008-07-23 02:12:05 UTC (rev 870) @@ -0,0 +1,261 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="MSVCUnitTest" + ProjectGUID="{79729949-F144-4098-BFE9-B6320E6AC3F6}" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="../../include" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + BufferSecurityCheck="true" + TreatWChar_tAsBuiltInType="true" + ForceConformanceInForLoopScope="true" + RuntimeTypeInfo="true" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)/UnitTest.exe" + LinkIncremental="2" + GenerateDebugInformation="true" + ProgramDatabaseFile="$(OutDir)/UnitTest.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <T... [truncated message content] |
From: <syn...@us...> - 2008-08-08 22:06:31
|
Revision: 895 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=895&view=rev Author: syntheticpp Date: 2008-08-08 22:06:26 +0000 (Fri, 08 Aug 2008) Log Message: ----------- GCC 4.2 fixes Modified Paths: -------------- trunk/include/loki/LevelMutex.h trunk/src/LevelMutex.cpp trunk/test/ScopeGuard/main.cpp Modified: trunk/include/loki/LevelMutex.h =================================================================== --- trunk/include/loki/LevelMutex.h 2008-07-25 05:36:01 UTC (rev 894) +++ trunk/include/loki/LevelMutex.h 2008-08-08 22:06:26 UTC (rev 895) @@ -1,1206 +1,1208 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// LevelMutex facility for the Loki Library -// Copyright (c) 2008 Richard Sposato -// The copyright on this file is protected under the terms of the MIT license. -// -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this -// permission notice appear in supporting documentation. -// -// The author makes no representations about the suitability of this software -// for any purpose. It is provided "as is" without express or implied warranty. -// -//////////////////////////////////////////////////////////////////////////////// - -// $Id$ - -/// @file LevelMutex.h Defines classes and functions for LevelMutex facility. - -#ifndef LOKI_LEVEL_MUTEX_H_INCLUDED -#define LOKI_LEVEL_MUTEX_H_INCLUDED - - -// ---------------------------------------------------------------------------- - -#include <vector> -#include <assert.h> -#include <time.h> - -#if defined( _MSC_VER ) - #include <Windows.h> -#else - #include <pthread.h> -#endif - - -/** @par thread_local Keyword - The mutexes require compilers to provide thread local storage - meaning each - thread gets its own copy of the data. The next version of C++ will have a - new keyword, thread_local for that purpose. Some existing compilers already - provide thread local storage using different syntax, so these lines use - thread_local to mimic that syntax. If your compiler provides thread local - storage but using different syntax besides "thread_local", you may want to - modify these lines. If your compiler does not support thread local storage, - you can't use LevelMutex. - */ -#ifndef LOKI_THREAD_LOCAL - #if defined( _MSC_VER ) - #if ( _MSC_VER >= 1300 ) - #define LOKI_THREAD_LOCAL __declspec( thread ) - #else - #error "Only Visual Studio versions 7.0 and after supported." - #endif - - #elif ( __GNUC__ ) - #define LOKI_THREAD_LOCAL __thread - - #else - #warning "Check if your compiler provides thread local storage." - #define LOKI_THREAD_LOCAL thread_local - #endif -#endif - -#if defined( DEBUG ) || defined( _DEBUG ) - #define LOKI_MUTEX_DEBUG_CODE( x ) x -#else - #define LOKI_MUTEX_DEBUG_CODE( x ) -#endif - - -namespace Loki -{ - - -// ---------------------------------------------------------------------------- - -class MutexErrors -{ -public: - - /// @enum Type Possible error conditions detected by LevelMutex functions. - enum Type - { - Success = 0, ///< Operation occurred correctly. - NoProblem, ///< Pre-lock and pre-unlock checks passed. - WrongLevel, ///< All mutexes in container must have same level. - LevelTooLow, ///< Trying to unlock a mutex lower than current level. - LevelTooHigh, ///< Trying to lock a mutex higher than current level. - TryFailed, ///< TryLock call failed to lock mutex. - NullMutexPointer, ///< Container has a NULL pointer in it. - DuplicateMutex, ///< Container must have unique pointers - no duplicates. - EmptyContainer, ///< Container must have at least 1 pointer in it. - AlreadyLocked, ///< TryLock call failed because mutex already locked. - WasntLocked, ///< Unlock failed because mutex was not even locked. - NotRecentLock, ///< Mutex in container was not recently locked by this thread. - NotLockedByThread, ///< Can't unlock a mutex not locked by this thread. - MultiUnlockFailed, ///< MultiUnlock can't unlock at least 1 mutex in container. - TimedOut, ///< Wait time elapsed without locking mutex. - TooMuchRecursion, ///< Tried to relock a PThread mutex which is not re-entrant. - NotInitialized, ///< Tried to lock a PThread mutex which did not get setup. - AlreadyInitialized, ///< PThread mutex initialized before ctor called. - InvalidAttribute, ///< PThread mutex improperly initialized. - InvalidAddress, ///< Bad pointer used to initialize a PThread mutex. - ExceptionThrown, ///< Exception caught in mutex operation. - MayDeadlock, ///< Locking this mutex may cause a deadlock. - OtherError ///< Unknown error occurred. - }; -}; - -// ---------------------------------------------------------------------------- - -/** @class LevelMutexInfo - This monolithic base class stores common info for a template class used to - control mutexes. The template class, LevelMutex, is policy-based class. - - @par Implementation - Each thread has a list of mutexes it locked. When a mutex first gets locked, it - gets added to the head of the list. If locked again, LevelMutex merely increments - a count. When unlocked, the count gets decremented until it reaches zero, and - then it gets removed from the list. Each mutex has a pointer to the mutex most - recently locked by the current thread. The current level of a thread is always - the level of the most recently locked mutex, or UnlockedLevel if the thread does - not have any mutexes locked now. A mutex is considered "recently" locked if it is at - the head of the list, or the same level as the current mutex and also locked by the - current thread. - - @par Class Invariants - This class maintains invariants for each LevelMutexInfo so that no function - calls corrupt a mutex. Each function makes a call to IsValid at the start so - that LevelMutex knows it acts on valid internal data. Many functions call - IsValid again when they return to insure the function did not leave any data in - an invalid state. The exit call to IsValid occurs through a tiny helper class - called Checker to insure all data remain valid even when exceptions occur. - Another helper class, MutexUndoer, unlocks mutexes in a container if an - exception occurs during calls to MultiLock. - - @par Error Results - Many functions return an enum value to indicate an error status. Many enum values - indicate errors detected within LevelMutex, but some indicate errors found in policy - classes, SpinLevelMutex and SleepLevelMutex. - */ - -class LevelMutexInfo -{ -public: - - /** Level for thread that has not locked any mutex. Maximum possible level - for a mutex is UnlockedLevel-1; No mutex may have a level of UnlockedLevel. - */ - static const unsigned int UnlockedLevel = 0xFFFFFFFF; - - /// Container for locking multiple mutexes at once. - typedef ::std::vector< volatile LevelMutexInfo * > MutexContainer; - typedef MutexContainer::iterator LevelMutexContainerIter; - typedef MutexContainer::const_iterator LevelMutexContainerCIter; - typedef MutexContainer::reverse_iterator LevelMutexContainerRIter; - typedef MutexContainer::const_reverse_iterator LevelMutexContainerCRIter; - - /** Locks several mutexes at once. Requires O(m + n*n) actions where m is the - number of mutexes currently locked by the thread and n is the number of mutexes - in the container. This provides strong exception safety. If an exception occurs, - any mutexes that were locked during this call will get unlocked. - @param mutexes Container of pointers to mutexes. Container must have at - least 1 mutex, all mutexes must have the same level, no NULL pointers, and all - mutexes must not exceed the thread's current level. This sorts the container - by address order. - @return Enum value indicating success or error. - */ - static MutexErrors::Type MultiLock( MutexContainer & mutexes ); - - /** Locks several mutexes at once. Requires O(m + n*n + n*t) actions where m is - the number of mutexes currently locked by the thread, n is the number of mutexes - in the container, and t is the wait time for each mutex. This provides strong - exception safety. If an exception occurs, any mutexes that were locked during - this call will ge unlocked. - @param mutexes Container of pointers to mutexes. Container must have at - least 1 mutex, all mutexes must have the same level, no NULL pointers, and all - mutexes must not exceed the thread's current level. This sorts the container - by address order. - @param milliSeconds Amount of time to wait for each mutex. - @return Enum value indicating success or error. - */ - static MutexErrors::Type MultiLock( MutexContainer & mutexes, - unsigned int milliSeconds ); - - /** Unlocks several mutexes at once. Requires O(m) actions where m is the number of - mutexes in the container. This provides strong exception safety. If an exception - occurs when unlocking one mutex, other mutexes in the container get unlocked anyway. - @param mutexes Container of pointers to mutexes. Container must have at least 1 - mutex, all mutexes must have the same level, no NULL pointers, and all mutexes must - be locked by the current thread. This sorts the container dby address order. - @return Enum value indicating success or error. - */ - static MutexErrors::Type MultiUnlock( MutexContainer & mutexes ); - - /** Gives pointer to most recently locked mutex, or NULL if nothing locked. - The pointer is for a const mutex so the mutex can't be modified inappropriately. - The pointer is for a volatile mutex so callers can call volatile member - functions to get info about the mutex. - */ - static const volatile LevelMutexInfo * GetCurrentMutex( void ); - - /// Returns the level of this mutex. - inline unsigned int GetLevel( void ) const volatile { return m_level; } - - /// Returns true if this mutex was locked at least once. - inline bool IsLocked( void ) const volatile { return ( 0 < m_count ); } - - /// Returns count of how many times this mutex got locked. - inline unsigned int GetLockCount( void ) const volatile { return m_count; } - - /// Returns pointer to mutex previously locked by the thread which locked this. - inline const volatile LevelMutexInfo * GetPrevious( void ) const volatile - { - return m_previous; - } - - /** Tries to lock mutex, and returns immediately if mutex already locked by - another thread. It will return immediately with a value of AlreadyLocked - if the mutex was locked by a different thread. It may throw an exception - or assert when errors occur if the ErrorPolicy class implements that behavior. - @return An error condition if any occurred, else Success. - */ - virtual MutexErrors::Type TryLock( void ) volatile = 0; - - /** Blocking call will attempt to lock mutex and wait until it can lock. - This may throw an exception if the lock failed or an error occurred - if - that is what the error policy specifies. - @return An error condition if any occurred, else Success. - */ - virtual MutexErrors::Type Lock( void ) volatile = 0; - - /** Attempts to lock mutex, but only waits for a limited amount of time - before it gives up. Will return quickly if an error occurs before any - attempt to lock. This may throw an exception if the lock failed or an - error occurred - if that is what the error policy specifies. - @param milliSeconds How long to wait. - @return An error condition if any occurred, else Success. - */ - virtual MutexErrors::Type Lock( unsigned int milliSeconds ) volatile = 0; - - /** Unlocks the mutex, or returns an error condition. This may throw an - exception if the lock failed or an error occurred - if that is what the - error policy specifies. - @return An error condition if any occurred, else Success. - */ - virtual MutexErrors::Type Unlock( void ) volatile = 0; - - /** Returns true if this mutex was locked by current thread, and level is the same - as the current thread's level. Which means this was the most recently locked - mutex, or it was locked along with several others of the same level recently. - */ - bool IsRecentLock( void ) const volatile; - - /** Returns true if this mutex was locked within the last count mutexes. - @param count How many recent mutexes to look through to find this mutex. - */ - bool IsRecentLock( unsigned int count ) const volatile; - - /// Returns true if this was locked by current thread. - bool IsLockedByCurrentThread( void ) const volatile; - - /// Returns true if this was locked by another thread. - bool IsLockedByAnotherThread( void ) const volatile; - -protected: - - /** @class Checker Performs validity check on mutex to insure no class invariants - were violated inside any member function. This class only gets used in debug - builds, and any instance of it gets optimized away in release builds. A checker - is created inside many of member functions so that it's destructor gets called - when the function exits. It determines if any class invariants were violated - during the function call. - */ - class Checker - { - public: - inline explicit Checker( const volatile LevelMutexInfo * mutex ) : - m_mutex( mutex ) {} - inline ~Checker( void ) { m_mutex->IsValid(); } - private: - Checker( void ); - Checker( const Checker & ); - Checker & operator = ( const Checker & ); - const volatile LevelMutexInfo * m_mutex; - }; - - /** @class MutexUndoer - Undoes actions by MultiLock if an exception occurs. It keeps track of - which mutexes in a container got locked, and if an exception occurs, then - the destructor unlocks them. If MultiLock succeeds, then it cancels the - undoer so nothing gets unlocked inadvertently. - */ - class MutexUndoer - { - public: - - explicit MutexUndoer( MutexContainer & mutexes ); - ~MutexUndoer( void ); - void SetPlace( LevelMutexContainerIter & here ); - void Cancel( void ); - - private: - - MutexUndoer( void ); - MutexUndoer( const MutexUndoer & ); - MutexUndoer & operator = ( const MutexUndoer & ); - - MutexContainer & m_mutexes; - LevelMutexContainerIter m_here; - }; - - /** Returns true if linked-list of locked mutexes in this thread is valid. - Which means the list has no loops, and each previous mutex on the list has a - higher or same level as the current mutex. Called by IsValid. - */ - static bool IsValidList( void ); - - /** This is the only available constructor, and it forces any derived class to set - a level for each mutex. - */ - explicit LevelMutexInfo( unsigned int level ); - - /// The destructor only gets called by the derived class. - virtual ~LevelMutexInfo( void ); - - MutexErrors::Type PreLockCheck( bool forTryLock ) volatile; - - MutexErrors::Type PreUnlockCheck( void ) volatile; - - /** This gets called after each call to DoLock and DoTryLock to make sure the data - members in this object get set correctly. - */ - void PostLock( void ) volatile; - - /// Gets called just before an attempt to unlock a mutex. - void PreUnlock( void ) volatile; - - /// Called to relock a mutex already locked by the current thread. - void IncrementCount( void ) volatile; - - /// Called to unlock a mutex locked multiple times by the current thread. - void DecrementCount( void ) volatile; - - /** Returns true if no class invariant broken, otherwise asserts. This function - only gets called in debug builds. - */ - bool IsValid( void ) const volatile; - -private: - - /// Copy constructor is not implemented. - LevelMutexInfo( const LevelMutexInfo & ); - /// Copy-assignment operator is not implemented. - LevelMutexInfo & operator = ( const LevelMutexInfo & ); - - /** Called only by MultiLock & MultiUnlock to pass a result through an - error checking policy. - @param result What error condition to check. - @return Result or assertion or an exception - depending on error policy. - */ - virtual MutexErrors::Type DoErrorCheck( MutexErrors::Type result ) const volatile = 0; - - /// Called only by MultiLock to Lock each particular mutex within a container. - virtual MutexErrors::Type LockThis( void ) volatile = 0; - - /** Called only by MultiLock to lock each particular mutex within a container. - @param milliSeconds How much time to wait before giving up on locking a mutex. - */ - virtual MutexErrors::Type LockThis( unsigned int milliSeconds ) volatile = 0; - - /// Called only by MultiUnlock to unlock each particular mutex within a container. - virtual MutexErrors::Type UnlockThis( void ) volatile = 0; - - /// Pointer to singly-linked list of mutexes locked by the current thread. - static LOKI_THREAD_LOCAL volatile LevelMutexInfo * s_currentMutex; - - /// Level of this mutex. - const unsigned int m_level; - - /// How many times this mutex got locked. - unsigned int m_count; - - /// Pointer to mutex locked before this one. - volatile LevelMutexInfo * m_previous; - -}; - -// ---------------------------------------------------------------------------- - -/** @class ThrowOnAnyMutexError - Implements the ErrorPolicy for LevelMutex and throws an exception for any - error condition. Only allows MutexErrors::Success and MutexErrors::NoProblem - to get through. Useful for release builds. - */ -class ThrowOnAnyMutexError -{ -public: - static MutexErrors::Type CheckError( MutexErrors::Type error, - unsigned int level ); -}; - -// ---------------------------------------------------------------------------- - -/** @class ThrowOnBadDesignMutexError - Implements the ErrorPolicy for LevelMutex and throws an exception if the error - indicates the programmer did not levelize the calls to mutexes. Otherwise - returns the error result. Useful for release builds. - */ -class ThrowOnBadDesignMutexError -{ -public: - static MutexErrors::Type CheckError( MutexErrors::Type error, - unsigned int level ); -}; - -// ---------------------------------------------------------------------------- - -/** @class AssertAnyMutexError - Implements the ErrorPolicy for LevelMutex and asserts for any error condition. - Only allows MutexErrors::Success and MutexErrors::NoProblem to get through. - Useful for testing mutexes in debug builds. - */ -class AssertAnyMutexError -{ -public: - static inline MutexErrors::Type CheckError( MutexErrors::Type error, - unsigned int level ) - { - (void)level; - assert( ( error == MutexErrors::Success ) - || ( error == MutexErrors::NoProblem ) ); - return error; - } -}; - -// ---------------------------------------------------------------------------- - -/** @class AssertBadDesignMutexError - Implements the ErrorPolicy for LevelMutex and asserts if the error - indicates the programmer did not levelize the calls to mutexes. Otherwise - returns the error result. Useful for testing mutexes in debug builds. - */ -class AssertBadDesignMutexError -{ -public: - static inline MutexErrors::Type CheckError( MutexErrors::Type error, - unsigned int level ) - { - (void)level; - assert( ( error != MutexErrors::LevelTooHigh ) - && ( error != MutexErrors::LevelTooLow ) ); - return error; - } -}; - -// ---------------------------------------------------------------------------- - -/** @class JustReturnMutexError - Implements the ErrorPolicy for LevelMutex and does nothing no matter how bad - the error condition. Only recommended use is for automated unit-testing of - mutex policies. - */ -class JustReturnMutexError -{ -public: - static inline MutexErrors::Type CheckError( MutexErrors::Type error, - unsigned int level ) - { - (void)level; - return error; - } -}; - -// ---------------------------------------------------------------------------- - -/** @class NoMutexWait - Implements the WaitPolicy for LevelMutex. Does nothing at all so it turns - all wait loops into spin loops. Useful for low-level mutexes. - */ -class NoMutexWait -{ -public: - static inline void Wait( void ) {} -}; - -// ---------------------------------------------------------------------------- - -/** @class MutexSleepWaits - Implements the WaitPolicy for LevelMutex. Sleeps for a moment so thread won't - consume idle CPU cycles. Useful for high-level mutexes. - */ -class MutexSleepWaits -{ -public: - static void Wait( void ); - static unsigned int sleepTime; -}; - -// ---------------------------------------------------------------------------- - -/** @class SpinLevelMutex - Implements a spin-loop to wait for the mutex to unlock. Since this class makes - the thread wait in a tight spin-loop, it can cause the thread to remain busy - while waiting and thus consume CPU cycles. For that reason, this mutex is best - used only for very low-level resources - especially resources which do not - require much CPU time to exercise. Rule of thumb: Use this only if all actions - on the resource consume a very small number of CPU cycles. Otherwise, use the - SleepLevelMutex instead. - */ -class SpinLevelMutex -{ -public: - - /// Constructs a spin-level mutex. - explicit SpinLevelMutex( unsigned int level ); - - /// Destructs the mutex. - virtual ~SpinLevelMutex( void ); - - virtual MutexErrors::Type Lock( void ) volatile; - - virtual MutexErrors::Type TryLock( void ) volatile; - - virtual MutexErrors::Type Unlock( void ) volatile; - - inline unsigned int GetLevel( void ) const volatile { return m_level; } - -private: - - /// Copy constructor is not implemented. - SpinLevelMutex( const SpinLevelMutex & ); - /// Copy-assignment operator is not implemented. - SpinLevelMutex & operator = ( const SpinLevelMutex & ); - -#if defined( _MSC_VER ) - #if ( _MSC_VER >= 1300 ) - /// The actual mutex. - CRITICAL_SECTION m_mutex; - #else - #error "Only Visual Studio versions 7.0 and after supported." - #endif - -#elif ( __GNUC__ ) - /// The actual mutex. - pthread_mutex_t m_mutex; - -#else - #error "Check if any mutex libraries are compatible with your compiler." -#endif - - /// Keep a copy of the mutex level around for error reporting. - const unsigned int m_level; - -}; // end class SpinLevelMutex - -// ---------------------------------------------------------------------------- - -/** @class SleepLevelMutex - Implements a sleeping loop to wait for the mutex to unlock. - - @par Purpose - Since this class puts the thread to sleep for short intervals, you can use this - class for most of your mutexes. Especially for locking any high level resources - where any one operation on the resouce consumes many CPU cycles. The purpose of - this mutex is to reduce the number of CPU cycles spent in idle loops. All - SleepLevelMutex's should have higher levels than all your SpinLevelMutex's. - - @par Dependence on SpinLevelMutex - This utilizes SpinLevelMutex so it does not have to re-implement the DoTryLock - and DoUnlock functions the same way. All it really needs is a DoLock function - and the amount of time it should sleep if an attempt to lock a function fails. - */ -class SleepLevelMutex : public SpinLevelMutex -{ -public: - - /** Constructs a levelized mutex that puts threads to sleep while they wait - for another thread to unlock the mutex. - @param level Level of this mutex. - */ - explicit SleepLevelMutex( unsigned int level ); - - /// Destructs the mutex. - virtual ~SleepLevelMutex( void ); - - inline unsigned int GetSleepTime( void ) const volatile { return m_sleepTime; } - - inline void SetSleepTime( unsigned int sleepTime ) volatile - { - if ( 0 != sleepTime ) - m_sleepTime = sleepTime; - } - -#if defined( _MSC_VER ) - inline bool GetWakable( void ) const volatile { return m_wakable; } - inline void SetWakable( bool wakable ) volatile { m_wakable = wakable; } -#endif - - /** Attempts to lock a mutex, and if it fails, then sleeps for a while - before attempting again. - */ - virtual MutexErrors::Type Lock( void ) volatile; - -private: - - /// Default constructor is not implemented. - SleepLevelMutex( void ); - /// Copy constructor is not implemented. - SleepLevelMutex( const SleepLevelMutex & ); - /// Copy-assignment operator is not implemented. - SleepLevelMutex & operator = ( const SleepLevelMutex & ); - -#if defined( _MSC_VER ) - #if ( _MSC_VER >= 1300 ) - /// True if operating system may wake thread to respond to events. - bool m_wakable; - #else - #error "Only Visual Studio versions 7.0 and after supported." - #endif -#endif - - /// How many milli-seconds to sleep before trying to lock mutex again. - unsigned int m_sleepTime; - -}; // end class SleepLevelMutex - -// ---------------------------------------------------------------------------- - -/** @class LevelMutex - Levelized mutex class prevents deadlocks by requiring programs to lock mutexes in - the same order, and unlock them in reverse order. This is accomplished by forcing - each mutex to have a level and forcing code to lock mutexes with higher levels - before locking mutexes at lower levels. If you want to lock several mutexes, they - must be locked in decreasing order by level, or if they are all of the same level, - then locked by LevelMutex::MultiLock. - - @par Features - - Immune: Very unlikely to deadlock since all mutexes are locked in the same - order and unlocked in reverse order. - - Scalable: Can handle any number of mutexes. - - Efficient: Many operations occur in constant time, and most operations require - no more than O(m) steps. - - Exception safe: All operations provide strong safety or don't throw. - - Extendable: Can work with existing mutexes through policy-based design. - - Easily Extended: Derived classes only need to implement 5 functions and a mutex - to get all the features of this class. - - Re-Entrant: Allows for re-entrancy even if mutexes in policy classes don't. - - Cost-Free: No resource allocations occur in LevelMutex - although user-defined - policy classes may allocate resources. - - Compact: Each LevelMutex object is small. - - Portable: As long as your compiler and libraries can meet the requirements. - - Robust: Maintains data integrity even if exceptions occur in policy classes. - - Affording: Several functions provide information about a mutex which allows - client code to easily choose correct actions. - - @par Requirements - - Your compiler must allow for thread-specific data. - - You must have a threading or mutex library. - - @par Policy-Based Design - This class hosts 3 policies and a default level. The policy-based design allows - users to write their own policies to extend the behaviors of LevelMutex. The - paragraphs below say how to design a class for each policy. - - MutexPolicy The mutex policy class. - - defaultLevel A level for existing client code that calls a default constructor. - - ErrorPolicy How the mutex should handle error conditions. - - WaitPolicy Whether a thread should wait, and how long in some internal loops. - - @par MutexPolicy - A policy class that wraps a low-level mutex. Loki provides two policy classes - for the actual mutex (SpinLevelMutex and SleepLevelMutex), both of which wrap - either pthreads or the Windows CRITICAL_SECTION. If you want to use a mutex - mechanism besides one of those, then all you have to do is provide a class - which wraps the mutex and implements these functions. - explicit SpinLevelMutex( unsigned int level ); - virtual ~SpinLevelMutex( void ); - virtual MutexErrors::Type Lock( void ) volatile; - virtual MutexErrors::Type TryLock( void ) volatile; - virtual MutexErrors::Type Unlock( void ) volatile; - Indeed, since the base class does most of the work, and provides all the interace - and functionality to client classes, a derived class has very few requirements. - It only needs to implement a single constructor, the destructor, some virtual - functions, and whatever data members it requires. You don't actually need to - declare those functions as virtual if the policy class is not a base or child - class. In the parlance of design patterns, LevelMutex is a Template, and the - MutexPolicy is a Strategy. - - @par DefaultLevel - The template class requires a default level to use inside the default constructor. - Some existing code calls instantiates mutexes with a default constructor, so the - mutex must know what level to use there. Please do not use zero or UnlockedLevel - as the default level. - - @par ErrorPolicy - This policy specifies how to handle error conditions. The mutexes can return - errors, assert, or throw exceptions. I recommend that debug code use asserts, - release code use exceptions, and unit-testing code just return errors. The - error policy class only needs to implement one function: - static MutexErrors::Type CheckError( MutexErrors::Type error, unsigned int level ); - - @par WaitPolicy - This states whether the mutex should wait within some tight internal loops, - how the waiting is done, and for how long. A wait policy class could sleep, - do nothing, check if other objects need attention, or check if the program - received events or notices from the operating system. It only needs to - implement one function: - static void Wait( void ); - - @par Per-Function Usage - If you implement a function with a static local mutex, then you have to insure - the function is not called from a lower level via call-backs, virtual functions in - interface classes. If the function does get called from a lower level, you are - setting up a potential deadlock. LevelMutex will detect that by checking the - current level and the local mutex's level, so it will refuse to lock the local mutex. - - @par Per-Object Usage - If you use a mutex as a data member of an object to protect that object, then I - recommend specifying which functions are volatile and which are not, and then only - use the mutex within the volatile functions. You may also want to provide accessor - functions so that client code can lock and unlock the mutex either to allow for - calling multiple operations without having to lock and unlock before and after each - operation, or so they can lock it along with several other objects at the same - level. - - @par Per-Class Usage - If you make a static data member within a class, you can use that to lock any - resources shared by those objects, or to require threads to act on only one object - at a time. You may also want to provide static accessor functions so that client - code can lock several other resources at the same level. - */ - -template -< - class MutexPolicy, - unsigned int DefaultLevel, - class ErrorPolicy = ::Loki::ThrowOnBadDesignMutexError, - class WaitPolicy = ::Loki::NoMutexWait -> -class LevelMutex : public LevelMutexInfo -{ -public: - - typedef typename ErrorPolicy EP; - typedef typename WaitPolicy WP; - typedef typename MutexPolicy MP; - - /** This constructor allows callers to replace the default level with another - value. It also acts as the default constructor for existing code which uses - default construction for mutexes. This is the only time the DefaultLevel - template parameter gets used. - */ - explicit LevelMutex( unsigned int level = DefaultLevel ) : - LevelMutexInfo( level ), - m_mutex( level ) - { - assert( IsValid() ); - } - - /// The destructor. - ~LevelMutex( void ) - { - assert( IsValid() ); - } - - /** These functions allow callers to access the mutex in case they need to - modify specific values in the MutexPolicy (e.g. - sleep time, functors to - call as tasks, etc...) There is one function for every combination of - const and volatile qualifiers so callers get a reference to a MutexPolicy - with the proper qualifiers. - */ - inline const volatile MutexPolicy & GetMutexPolicy( void ) const volatile { return m_mutex; } - inline volatile MutexPolicy & GetMutexPolicy( void ) volatile { return m_mutex; } - inline const MutexPolicy & GetMutexPolicy( void ) const { return m_mutex; } - inline MutexPolicy & GetMutexPolicy( void ) { return m_mutex; } - - virtual MutexErrors::Type TryLock( void ) volatile - { - assert( IsValid() ); - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) - - MutexErrors::Type result = LevelMutexInfo::PreLockCheck( true ); - if ( MutexErrors::Success == result ) - return MutexErrors::Success; - else if ( MutexErrors::AlreadyLocked == result ) - return result; - else if ( MutexErrors::NoProblem != result ) - return EP::CheckError( result, GetLevel() ); - - assert( 0 == LevelMutexInfo::GetLockCount() ); - result = m_mutex.TryLock(); - if ( MutexErrors::Success != result ) - return EP::CheckError( result, GetLevel() ); - LevelMutexInfo::PostLock(); - - return MutexErrors::Success; - } - - virtual MutexErrors::Type Lock( void ) volatile - { - assert( IsValid() ); - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) - - MutexErrors::Type result = LevelMutexInfo::PreLockCheck( false ); - if ( MutexErrors::Success == result ) - return MutexErrors::Success; - else if ( MutexErrors::NoProblem != result ) - return EP::CheckError( result, GetLevel() ); - - assert( !LevelMutexInfo::IsLockedByCurrentThread() ); - result = m_mutex.Lock(); - if ( MutexErrors::Success != result ) - return EP::CheckError( result, GetLevel() ); - PostLock(); - - return MutexErrors::Success; - } - - virtual MutexErrors::Type Lock( unsigned int milliSeconds ) volatile - { - assert( IsValid() ); - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) - - MutexErrors::Type result = LevelMutexInfo::PreLockCheck( false ); - if ( MutexErrors::Success == result ) - return MutexErrors::Success; - else if ( MutexErrors::NoProblem != result ) - return EP::CheckError( result, GetLevel() ); - - assert( !LevelMutexInfo::IsLockedByCurrentThread() ); - clock_t timeOut = clock() + milliSeconds; - while ( clock() < timeOut ) - { - WP::Wait(); - result = m_mutex.TryLock(); - switch ( result ) - { - case MutexErrors::Success: - { - PostLock(); - return MutexErrors::Success; - } - case MutexErrors::AlreadyLocked: - return MutexErrors::AlreadyLocked; - case MutexErrors::TryFailed: - break; - default: - return EP::CheckError( result, GetLevel() ); - } - } - - return MutexErrors::TimedOut; - } - - virtual MutexErrors::Type Unlock( void ) volatile - { - assert( IsValid() ); - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) - - MutexErrors::Type result = LevelMutexInfo::PreUnlockCheck(); - if ( MutexErrors::Success == result ) - return MutexErrors::Success; - else if ( MutexErrors::NoProblem != result ) - return EP::CheckError( result, GetLevel() ); - - LevelMutexInfo::PreUnlock(); - result = MutexErrors::OtherError; - try - { - result = m_mutex.Unlock(); - if ( MutexErrors::Success != result ) - PostLock(); - } - catch ( ... ) - { - PostLock(); - result = MutexErrors::ExceptionThrown; - } - - return result; - } - -private: - - /// Copy constructor is not implemented since mutexes don't get copied. - LevelMutex( const LevelMutex & ); - /// Copy-assignment operator is not implemented since mutexes don't get copied. - LevelMutex & operator = ( const LevelMutex & ); - - virtual MutexErrors::Type DoErrorCheck( MutexErrors::Type result ) const volatile - { - return EP::CheckError( result, GetLevel() ); - } - - /** Called only by MultiLock to lock each particular mutex within a container. - This does not do pre-lock error checking since MultiLock does that. Since - this skips the error checking, that means that callers of LevelMutex should - not call this function directly, and so this will not be publicly available. - @return Error status indicating success or reason for failure. - */ - virtual MutexErrors::Type LockThis( void ) volatile - { - assert( IsValid() ); - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) - assert( this != LevelMutexInfo::GetCurrentMutex() ); - - const MutexErrors::Type result = m_mutex.Lock(); - if ( MutexErrors::Success != result ) - return result; - PostLock(); - - return MutexErrors::Success; - } - - /** Called only by MultiLock to lock each particular mutex within a container. - This does not do pre-lock error checking since MultiLock does that. Since - this skips the error checking, callers of LevelMutex should not call this - function directly, and so this will not be publicly available. - @param milliSeconds How much time to wait before giving up on locking a mutex. - @return Error status indicating success or reason for failure. - */ - virtual MutexErrors::Type LockThis( unsigned int milliSeconds ) volatile - { - assert( IsValid() ); - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) - - clock_t timeOut = clock() + milliSeconds; - while ( clock() < timeOut ) - { - WP::Wait(); - const bool locked = ( MutexErrors::Success == m_mutex.TryLock() ); - if ( locked ) - { - PostLock(); - return MutexErrors::Success; - } - } - - return MutexErrors::TimedOut; - } - - /** Called only by MultiUnlock to unlock each mutex within a container. - This does not do pre-unlock error checking since MultiLock does that. Since - this skips the error checking, callers of LevelMutex should not call this - function directly, and so this will not be publicly available. - @return Error status indicating success or reason for failure. - */ - virtual MutexErrors::Type UnlockThis( void ) volatile - { - assert( IsValid() ); - assert( NULL != LevelMutexInfo::GetCurrentMutex() ); - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) - - if ( 1 < LevelMutexInfo::GetLockCount() ) - { - LevelMutexInfo::DecrementCount(); - return MutexErrors::Success; - } - - LevelMutexInfo::PreUnlock(); - MutexErrors::Type result = m_mutex.Unlock(); - - return result; - } - - /// An instance of an unleveled mutex wrapped to match LevelMutex's needs. - MutexPolicy m_mutex; - -}; // end class LevelMutex - -// ---------------------------------------------------------------------------- - -/** Returns level of most recently locked mutex by this thread, or UnlockedLevel - if no mutexes are locked. Runs in constant time, and never throws exceptions. - */ -unsigned int GetCurrentThreadsLevel( void ); - -/** Returns count of how mutexes the current thread locked. Requires O(m) - actions where m is the number of mutexes in the thread. Never throws exceptions. - */ -unsigned int CountMutexesInCurrentThread( void ); - -/** Returns count of how mutexes the current thread locked. The lock count - exceeds the number of mutexes locked by current thread if any mutex got locked - more than once. Requires O(m) actions where m is the number of mutexes in the - thread. Never throws exceptions. - */ -unsigned int CountLocksInCurrentThread( void ); - -/** Returns count of mutexes locked by current thread which have the same level - as GetCurrentThreadsLevel. Requires O(m) actions where m is the number of - mutexes in the thread at current level. Never throws exceptions. - */ -unsigned int CountMutexesAtCurrentLevel( void ); - -/** Determines if container of mutexes matches the recently locked mutexes. - If they do match, it returns success, otherwise an error condition. - */ -MutexErrors::Type DoMutexesMatchContainer( const LevelMutexInfo::MutexContainer & mutexes ); - -// ---------------------------------------------------------------------------- - -/** @class MutexException - Exception class used to throw error statuses about LevelMutex's up to code that - can respond to mutex problems. This class exists because it conveys more info - about the error condition than just ::std::exception. - */ -class MutexException : public ::std::exception -{ -public: - - /** Constructs an exception which stores information about a mutex and the - reason an attempt to use a mutex failed. - */ - MutexException( const char * message, unsigned int level, MutexErrors::Type reason ); - - /// Copy constructor performs a member-by-member copy of an exception. - MutexException( const MutexException & that ) throw (); - - /// Copy-assignment operator performs a member-by-member copy of an exception. - MutexException & operator = ( const MutexException & that ) throw (); - - /// Destroys the exception. - virtual ~MutexException( void ); - - /// Returns a simple message about which operation failed. - virtual const char * what( void ) const; - - /// Returns level of mutex(es) used when problem occurred. - unsigned int GetLevel( void ) const { return m_level; } - - /// Returns an error status for why operation failed. - MutexErrors::Type GetReason( void ) const { return m_reason; } - -private: - - /// Default constructor is not implemented. - MutexException( void ) throw (); - - /// Simple message about operation that failed. - const char * m_message; - /// Level of mutex(es) used when problem occurred. - unsigned int m_level; - /// Error status for why operation failed. - MutexErrors::Type m_reason; - -}; // end class MutexException - -// ---------------------------------------------------------------------------- - -/** @class MutexLocker - You can place an instance of this as a local variable inside a function to lock - a single mutex. It will lock the mutex if no error occurs, or throw if one - does happen. When the function ends, the destructor will determine if it needs - to unlock the mutex. This RAII technique insures the mutex gets unlocked even - when exceptions occur. - */ -class MutexLocker -{ -public: - - /** Creates an object to lock an unlock a mutex for a function. This - will throw if an attempt to lock the mutex fails. - @param mutex Reference to the mutex. - @param lock True if function wants to lock the mutex as this gets - constructed. - */ - explicit MutexLocker( volatile LevelMutexInfo & mutex, bool lock = true ); - - /** Creates an object to lock an unlock a mutex for a function. This waits - a specified amount of time for another thread to unlock the mutex if it is - locked. This will throw if an attempt to lock the mutex fails. - @param mutex Reference to the mutex. - @param milliSeconds Amount of time to wait for another thread to unlock - the mutex. - @param lock True if function wants to lock the mutex as this gets - constructed. - */ - MutexLocker( volatile LevelMutexInfo & mutex, unsigned int milliSeconds, - bool lock = true ); - - /// Destructs the locker, and determines if it needs to unlock the mutex. - ~MutexLocker( void ); - - /** You can call this to lock (or relock) a mutex. In theory, you can lock - and unlock a mutex several times within a function in order to give other - threads access to a resource while this function does not need it. - @return True if mutex is locked by this, else false if not locked. - */ - bool Lock( void ); - - /** You can call this to unlock a mutex before the destructor does it. - By unlocking the mutexes before returning, the function can do other - operations without making other threads wait too long. - @return True if unlocked by this, else false if not unlocked by this. - (Which is not the same as whether the mutex itself is locked or not by - another thread.) - */ - bool Unlock( void ); - - /// Returns true if the mutex is locked by this object. - inline bool IsLocked( void ) const { return m_locked; } - - /// Provides access to mutex controlled by this. - const volatile LevelMutexInfo & GetMutex( void ) const { return m_mutex; } - -private: - - /// Default constructor is not implemented. - MutexLocker( void ); - /// Copy constructor is not implemented. - MutexLocker( const MutexLocker & ); - /// Copy-assignment operator is not implemented. - MutexLocker & operator = ( const MutexLocker & ); - - /// True if mutex got locked. - bool m_locked; - - /// Reference to mutex. - volatile LevelMutexInfo & m_mutex; -}; - -// ---------------------------------------------------------------------------- - -/** @class MultiMutexLocker - You can place an instance of this as a local variable inside a function to lock - a collection of mutexes. It locks them if no error occurs, or throws an - exception if one does happen. When the function ends, the destructor determines - if it needs to unlock the mutexes. This RAII technique insures the mutexes get - unlocked even when exceptions occur. You will also have to construct a - MutexContainer as a local object within the same function. - */ -class MultiMutexLocker -{ -public: - - /** Creates an object to lock and unlock a collection of mutexes for a function. - This will throw if an attempt to lock any mutex fails. If an exception occurs, - it unlocks mutexes it previously locked. - @param mutex Reference to a collection of mutexes. - @param lock True if function wants to lock the mutex as this gets - constructed. - */ - explicit MultiMutexLocker( LevelMutexInfo::MutexContainer & mutexes, - bool lock = true ); - - /** Creates an object to lock and unlock a collection of mutexes for a function. - This waits a specified amount of time for other threads to unlock each mutex - that is locked. This will throw if an attempt to lock any mutex fails. If an - exception occurs, it unlocks mutexes it previously locked. - @param mutexes Reference to a collection of mutexes. - @param milliSeconds Amount of time to wait for another thread to unlock - the mutex. - @param lock True if function wants to lock the mutexes as this gets - constructed. - */ - MultiMutexLocker( LevelMutexInfo::MutexContainer & mutexes, - unsigned int milliSeconds, bool lock = true ); - - /// Destructs the locker, and determines if it needs to unlock the mutexes. - ~MultiMutexLocker( void ); - - /** You can call this to lock (or relock) the mutexes. In theory, you can lock - and unlock mutexes several times within a function in order to give other - threads access to resources while this function does not need them. - @return True if mutex is locked by this, else false if not locked. - */ - bool Lock( void ); - - /** You can call this to unlock the mutexes before the destructor does it. - By unlocking the mutexes before returning, the function can do other - operations without making other threads wait too long. - @return True if unlocked by this, else false if not unlocked by this. - (Which is not the same as whether the mutex itself is locked or not by - another thread.) - */ - bool Unlock( void ); - - /// Returns true if the mutexes are locked by this object. - inline bool IsLocked( void ) const { return m_locked; } - - /// Provides access to the collection of mutexes controlled by this. - const LevelMutexInfo::MutexContainer & GetMutexes( void ) const { return m_mutexes; } - -private: - - /// Default constructor is not implemented. - MultiMutexLocker( void ); - /// Copy constructor is not implemented. - MultiMutexLocker( const MultiMutexLocker & ); - /// Copy-assignment operator is not implemented. - MultiMutexLocker & operator = ( const MultiMutexLocker & ); - - /// True if mutexes got locked. - bool m_locked; - - /// Reference to external container of mutexes; - LevelMutexInfo::MutexContainer & m_mutexes; -}; - -// ---------------------------------------------------------------------------- - -}; // end namespace Loki - -#endif // end file guardian +//////////////////////////////////////////////////////////////////////////////// +// +// LevelMutex facility for the Loki Library +// Copyright (c) 2008 Richard Sposato +// The copyright on this file is protected under the terms of the MIT license. +// +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this +// permission notice appear in supporting documentation. +// +// The author makes no representations about the suitability of this software +// for any purpose. It is provided "as is" without express or implied warranty. +// +//////////////////////////////////////////////////////////////////////////////// + +// $Id$ + +/// @file LevelMutex.h Defines classes and functions for LevelMutex facility. + +#ifndef LOKI_LEVEL_MUTEX_H_INCLUDED +#define LOKI_LEVEL_MUTEX_H_INCLUDED + + +// ---------------------------------------------------------------------------- + +#include <vector> +#include <assert.h> +#include <time.h> + +#if defined( _MSC_VER ) + #include <Windows.h> +#else + #include <pthread.h> +#endif + + +/** @par thread_local Keyword + The mutexes require compilers to provide thread local storage - meaning each + thread gets its own copy of the data. The next version of C++ will have a + new keyword, thread_local for that purpose. Some existing compilers already + provide thread local storage using different syntax, so these lines use + thread_local to mimic that syntax. If your compiler provides thread local + storage but using different syntax besides "thread_local", you may want to + modify these lines. If your compiler does not support thread local storage, + you can't use LevelMutex. + */ +#ifndef LOKI_THREAD_LOCAL + #if defined( _MSC_VER ) + #if ( _MSC_VER >= 1300 ) + #define LOKI_THREAD_LOCAL __declspec( thread ) + #else + #error "Only Visual Studio versions 7.0 and after supported." + #endif + + #elif ( __GNUC__ ) + #define LOKI_THREAD_LOCAL __thread + + #else + #warning "Check if your compiler provides thread local storage." + #define LOKI_THREAD_LOCAL thread_local + #endif +#endif + +#if defined( DEBUG ) || defined( _DEBUG ) + #define LOKI_MUTEX_DEBUG_CODE( x ) x +#else + #define LOKI_MUTEX_DEBUG_CODE( x ) +#endif + + +namespace Loki +{ + + +// ---------------------------------------------------------------------------- + +class MutexErrors +{ +public: + + /// @enum Type Possible error conditions detected by LevelMutex functions. + enum Type + { + Success = 0, ///< Operation occurred correctly. + NoProblem, ///< Pre-lock and pre-unlock checks passed. + WrongLevel, ///< All mutexes in container must have same level. + LevelTooLow, ///< Trying to unlock a mutex lower than current level. + LevelTooHigh, ///< Trying to lock a mutex higher than current level. + TryFailed, ///< TryLock call failed to lock mutex. + NullMutexPointer, ///< Container has a NULL pointer in it. + DuplicateMutex, ///< Container must have unique pointers - no duplicates. + EmptyContainer, ///< Container must have at least 1 pointer in it. + AlreadyLocked, ///< TryLock call failed because mutex already locked. + WasntLocked, ///< Unlock failed because mutex was not even locked. + NotRecentLock, ///< Mutex in container was not recently locked by this thread. + NotLockedByThread, ///< Can't unlock a mutex not locked by this thread. + MultiUnlockFailed, ///< MultiUnlock can't unlock at least 1 mutex in container. + TimedOut, ///< Wait time elapsed without locking mutex. + TooMuchRecursion, ///< Tried to relock a PThread mutex which is not re-entrant. + NotInitialized, ///< Tried to lock a PThread mutex which did not get setup. + AlreadyInitialized, ///< PThread mutex initialized before ctor called. + InvalidAttribute, ///< PThread mutex improperly initialized. + InvalidAddress, ///< Bad pointer used to initialize a PThread mutex. + ExceptionThrown, ///< Exception caught in mutex operation. + MayDeadlock, ///< Locking this mutex may cause a deadlock. + OtherError ///< Unknown error occurred. + }; +}; + +// ---------------------------------------------------------------------------- + +/** @class LevelMutexInfo + This monolithic base class stores common info for a template class used to + control mutexes. The template class, LevelMutex, is policy-based class. + + @par Implementation + Each thread has a list of mutexes it locked. When a mutex first gets locked, it + gets added to the head of the list. If locked again, LevelMutex merely increments + a count. When unlocked, the count gets decremented until it reaches zero, and + then it gets removed from the list. Each mutex has a pointer to the mutex most + recently locked by the current thread. The current level of a thread is always + the level of the most recently locked mutex, or UnlockedLevel if the thread does + not have any mutexes locked now. A mutex is considered "recently" locked if it is at + the head of the list, or the same level as the current mutex and also locked by the + current thread. + + @par Class Invariants + This class maintains invariants for each LevelMutexInfo so that no function + calls corrupt a mutex. Each function makes a call to IsValid at the start so + that LevelMutex knows it acts on valid internal data. Many functions call + IsValid again when they return to insure the function did not leave any data in + an invalid state. The exit call to IsValid occurs through a tiny helper class + called Checker to insure all data remain valid even when exceptions occur. + Another helper class, MutexUndoer, unlocks mutexes in a container if an + exception occurs during calls to MultiLock. + + @par Error Results + Many functions return an enum value to indicate an error status. Many enum values + indicate errors detected within LevelMutex, but some indicate errors found in policy + classes, SpinLevelMutex and SleepLevelMutex. + */ + +class LevelMutexInfo +{ +public: + + /** Level for thread that has not locked any mutex. Maximum possible level + for a mutex is UnlockedLevel-1; No mutex may have a level of UnlockedLevel. + */ + static const unsigned int UnlockedLevel = 0xFFFFFFFF; + + /// Container for locking multiple mutexes at once. + typedef ::std::vector< volatile LevelMutexInfo * > MutexContainer; + typedef MutexContainer::iterator LevelMutexContainerIter; + typedef MutexContainer::const_iterator LevelMutexContainerCIter; + typedef MutexContainer::reverse_iterator LevelMutexContainerRIter; + typedef MutexContainer::const_reverse_iterator LevelMutexContainerCRIter; + + /** Locks several mutexes at once. Requires O(m + n*n) actions where m is the + number of mutexes currently locked by the thread and n is the number of mutexes + in the container. This provides strong exception safety. If an exception occurs, + any mutexes that were locked during this call will get unlocked. + @param mutexes Container of pointers to mutexes. Container must have at + least 1 mutex, all mutexes must have the same level, no NULL pointers, and all + mutexes must not exceed the thread's current level. This sorts the container + by address order. + @return Enum value indicating success or error. + */ + static MutexErrors::Type MultiLock( MutexContainer & mutexes ); + + /** Locks several mutexes at once. Requires O(m + n*n + n*t) actions where m is + the number of mutexes currently locked by the thread, n is the number of mutexes + in the container, and t is the wait time for each mutex. This provides strong + exception safety. If an exception occurs, any mutexes that were locked during + this call will ge unlocked. + @param mutexes Container of pointers to mutexes. Container must have at + least 1 mutex, all mutexes must have the same level, no NULL pointers, and all + mutexes must not exceed the thread's current level. This sorts the container + by address order. + @param milliSeconds Amount of time to wait for each mutex. + @return Enum value indicating success or error. + */ + static MutexErrors::Type MultiLock( MutexContainer & mutexes, + unsigned int milliSeconds ); + + /** Unlocks several mutexes at once. Requires O(m) actions where m is the number of + mutexes in the container. This provides strong exception safety. If an exception + occurs when unlocking one mutex, other mutexes in the container get unlocked anyway. + @param mutexes Container of pointers to mutexes. Container must have at least 1 + mutex, all mutexes must have the same level, no NULL pointers, and all mutexes must + be locked by the current thread. This sorts the container dby address order. + @return Enum value indicating success or error. + */ + static MutexErrors::Type MultiUnlock( MutexContainer & mutexes ); + + /** Gives pointer to most recently locked mutex, or NULL if nothing locked. + The pointer is for a const mutex so the mutex can't be modified inappropriately. + The pointer is for a volatile mutex so callers can call volatile member + functions to get info about the mutex. + */ + static const volatile LevelMutexInfo * GetCurrentMutex( void ); + + /// Returns the level of this mutex. + inline unsigned int GetLevel( void ) const volatile { return m_level; } + + /// Returns true if this mutex was locked at least once. + inline bool IsLocked( void ) const volatile { return ( 0 < m_count ); } + + /// Returns count of how many times this mutex got locked. + inline unsigned int GetLockCount( void ) const volatile { return m_count; } + + /// Returns pointer to mutex previously locked by the thread which locked this. + inline const volatile LevelMutexInfo * GetPrevious( void ) const volatile + { + return m_previous; + } + + /** Tries to lock mutex, and returns immediately if mutex already locked by + another thread. It will return immediately with a value of AlreadyLocked + if the mutex was locked by a different thread. It may throw an exception + or assert when errors occur if the ErrorPolicy class implements that behavior. + @return An error condition if... [truncated message content] |
From: <syn...@us...> - 2008-08-08 22:20:21
|
Revision: 896 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=896&view=rev Author: syntheticpp Date: 2008-08-08 22:20:05 +0000 (Fri, 08 Aug 2008) Log Message: ----------- fix line endings Modified Paths: -------------- trunk/include/loki/Allocator.h trunk/include/loki/CheckReturn.h trunk/include/loki/Checker.h trunk/include/loki/SPCachedFactory.h trunk/test/CheckReturn/CheckReturn.dev trunk/test/CheckReturn/CheckReturn.vcproj trunk/test/CheckReturn/CheckReturn_MSVC_8.vcproj trunk/test/CheckReturn/main.cpp trunk/test/Checker/Checker_MSVC_9.vcproj trunk/test/Checker/main.cpp trunk/test/LevelMutex/LevelMutex_MSVC_9.vcproj trunk/test/LevelMutex/MultiThreadTests.cpp trunk/test/LevelMutex/MultiThreadTests.hpp trunk/test/LevelMutex/Thing.cpp trunk/test/LevelMutex/Thing.hpp trunk/test/LevelMutex/ThreadPool.cpp trunk/test/LevelMutex/ThreadPool.hpp trunk/test/LevelMutex/main.cpp Property Changed: ---------------- trunk/include/loki/Allocator.h trunk/include/loki/CheckReturn.h trunk/include/loki/Checker.h trunk/include/loki/LevelMutex.h trunk/include/loki/SPCachedFactory.h trunk/src/LevelMutex.cpp trunk/src/Library_MSVC_8.vcproj trunk/test/CachedFactory/CachedFactory.cbp trunk/test/CachedFactory/CachedFactory_MSVC_8.vcproj trunk/test/CheckReturn/CheckReturn.cbp trunk/test/CheckReturn/CheckReturn.dev trunk/test/CheckReturn/CheckReturn.vcproj trunk/test/CheckReturn/CheckReturn_MSVC_8.vcproj trunk/test/CheckReturn/main.cpp trunk/test/Checker/Checker.cbp trunk/test/Checker/Checker_MSVC_9.vcproj trunk/test/Checker/main.cpp trunk/test/DeletableSingleton/DeletableSingleton.cbp trunk/test/DeletableSingleton/DeletableSingleton_MSVC_8.vcproj trunk/test/Factory/Factory.cbp trunk/test/Factory/Factory_MSVC_8.vcproj trunk/test/Function/Function.cbp trunk/test/Function/Function_MSVC_8.vcproj trunk/test/LevelMutex/LevelMutex.cbp trunk/test/LevelMutex/LevelMutex_MSVC_9.vcproj trunk/test/LevelMutex/MultiThreadTests.cpp trunk/test/LevelMutex/MultiThreadTests.hpp trunk/test/LevelMutex/Thing.cpp trunk/test/LevelMutex/Thing.hpp trunk/test/LevelMutex/ThreadPool.cpp trunk/test/LevelMutex/ThreadPool.hpp trunk/test/LevelMutex/main.cpp trunk/test/LockingPtr/LockingPtr.cbp trunk/test/LockingPtr/LockingPtr_MSVC_8.vcproj trunk/test/Longevity/Longevity.cbp trunk/test/Longevity/Longevity_MSVC_8.vcproj trunk/test/OrderedStatic/OrderedStatic.cbp trunk/test/OrderedStatic/OrderedStatic_MSVC_8.vcproj trunk/test/Pimpl/Pimpl.cbp trunk/test/Pimpl/Pimpl_MSVC_8.vcproj trunk/test/Register/Register.cbp trunk/test/RegressionTest/MSVCUnitTest_MSVC_8.vcproj trunk/test/RegressionTest/RegressionTest.cbp trunk/test/SafeFormat/SafeFormat.cbp trunk/test/SafeFormat/SafeFormat_MSVC_8.vcproj trunk/test/ScopeGuard/ScopeGuard.cbp trunk/test/ScopeGuard/ScopeGuard_MSVC_8.vcproj trunk/test/Singleton/Singleton.cbp trunk/test/Singleton/Singleton_MSVC_8.vcproj trunk/test/SmallObj/DefaultAlloc.cbp trunk/test/SmallObj/DefaultAlloc_MSVC_8.vcproj trunk/test/SmallObj/SmallObj.cbp trunk/test/SmallObj/SmallObjCompare_MSVC_8.vcproj trunk/test/SmallObj/SmallObjSingleton_MSVC_8.vcproj trunk/test/SmartPtr/SmartPtr.cbp trunk/test/SmartPtr/SmartPtr_MSVC_8.vcproj trunk/test/Visitor/Visitor.cbp trunk/test/Visitor/Visitor_MSVC_8.vcproj trunk/test/flex_string/flex_string.cbp trunk/test/flex_string/flex_string_MSVC_8.vcproj Modified: trunk/include/loki/Allocator.h =================================================================== --- trunk/include/loki/Allocator.h 2008-08-08 22:06:26 UTC (rev 895) +++ trunk/include/loki/Allocator.h 2008-08-08 22:20:05 UTC (rev 896) @@ -1,153 +1,153 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2008 by Rich Sposato -// -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this -// permission notice appear in supporting documentation. -// The author makes no representations about the -// suitability of this software for any purpose. It is provided "as is" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// - -#ifndef LOKI_ALLOCATOR_HPP_INCLUDED -#define LOKI_ALLOCATOR_HPP_INCLUDED - -// $Id$ - -// Requires project to be compiled with loki/src/SmallObj.cpp and loki/src/Singleton.cpp - -#include <loki/SmallObj.h> - - -namespace Loki -{ - - -//----------------------------------------------------------------------------- - -/** @class LokiAllocator - Adapts Loki's Small-Object Allocator for STL container classes. - This class provides all the functionality required for STL allocators, but - uses Loki's Small-Object Allocator to perform actual memory operations. - Implementation comes from a post in Loki forums (by Rasmus Ekman?). - */ -template -< - typename Type, - typename AllocT = Loki::AllocatorSingleton<> -> -class LokiAllocator -{ -public: - - typedef ::std::size_t size_type; - typedef ::std::ptrdiff_t difference_type; - typedef Type * pointer; - typedef const Type * const_pointer; - typedef Type & reference; - typedef const Type & const_reference; - typedef Type value_type; - - /// Default constructor does nothing. - inline LokiAllocator( void ) throw() { } - - /// Copy constructor does nothing. - inline LokiAllocator( const LokiAllocator & ) throw() { } - - /// Type converting allocator constructor does nothing. - template < typename Type1 > - inline LokiAllocator( const LokiAllocator< Type1 > & ) throw() { } - - /// Destructor does nothing. - inline ~LokiAllocator() throw() { } - - /// Convert an allocator<Type> to an allocator <Type1>. - template < typename Type1 > - struct rebind - { - typedef LokiAllocator< Type1 > other; - }; - - /// Return address of reference to mutable element. - pointer address( reference elem ) const { return &elem; } - - /// Return address of reference to const element. - const_pointer address( const_reference elem ) const { return &elem; } - - /** Allocate an array of count elements. Warning! The true parameter in - the call to Allocate means this function can throw exceptions. This is - better than not throwing, and returning a null pointer in case the caller - assumes the return value is not null. - @param count # of elements in array. - @param hint Place where caller thinks allocation should occur. - @return Pointer to block of memory. - */ - pointer allocate( size_type count, const void * hint = 0 ) - { - (void)hint; // Ignore the hint. - void * p = AllocT::Instance().Allocate( count * sizeof( Type ), true ); - return reinterpret_cast< pointer >( p ); - } - - /// Ask allocator to release memory at pointer with size bytes. - void deallocate( pointer p, size_type size ) - { - AllocT::Instance().Deallocate( p, size * sizeof( Type ) ); - } - - /// Calculate max # of elements allocator can handle. - size_type max_size( void ) const throw() - { - // A good optimizer will see these calculations always produce the same - // value and optimize this function away completely. - const size_type max_bytes = size_type( -1 ); - const size_type bytes = max_bytes / sizeof( Type ); - return bytes; - } - - /// Construct an element at the pointer. - void construct( pointer p, const Type & value ) - { - // A call to global placement new forces a call to copy constructor. - ::new( p ) Type( value ); - } - - /// Destruct the object at pointer. - void destroy( pointer p ) - { - // If the Type has no destructor, then some compilers complain about - // an unreferenced parameter, so use the void cast trick to prevent - // spurious warnings. - (void)p; - p->~Type(); - } - -}; - -//----------------------------------------------------------------------------- - -/** All equality operators return true since LokiAllocator is basically a - monostate design pattern, so all instances of it are identical. - */ -template < typename Type > -inline bool operator == ( const LokiAllocator< Type > &, const LokiAllocator< Type > & ) -{ - return true; -} - -/** All inequality operators return false since LokiAllocator is basically a - monostate design pattern, so all instances of it are identical. - */ -template < typename Type > -inline bool operator != ( const LokiAllocator< Type > & , const LokiAllocator< Type > & ) -{ - return false; -} - -//----------------------------------------------------------------------------- - -} // namespace Loki - -#endif // LOKI_ALLOCATOR_INCLUDED +//////////////////////////////////////////////////////////////////////////////// +// The Loki Library +// Copyright (c) 2008 by Rich Sposato +// +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this +// permission notice appear in supporting documentation. +// The author makes no representations about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. +//////////////////////////////////////////////////////////////////////////////// + +#ifndef LOKI_ALLOCATOR_HPP_INCLUDED +#define LOKI_ALLOCATOR_HPP_INCLUDED + +// $Id$ + +// Requires project to be compiled with loki/src/SmallObj.cpp and loki/src/Singleton.cpp + +#include <loki/SmallObj.h> + + +namespace Loki +{ + + +//----------------------------------------------------------------------------- + +/** @class LokiAllocator + Adapts Loki's Small-Object Allocator for STL container classes. + This class provides all the functionality required for STL allocators, but + uses Loki's Small-Object Allocator to perform actual memory operations. + Implementation comes from a post in Loki forums (by Rasmus Ekman?). + */ +template +< + typename Type, + typename AllocT = Loki::AllocatorSingleton<> +> +class LokiAllocator +{ +public: + + typedef ::std::size_t size_type; + typedef ::std::ptrdiff_t difference_type; + typedef Type * pointer; + typedef const Type * const_pointer; + typedef Type & reference; + typedef const Type & const_reference; + typedef Type value_type; + + /// Default constructor does nothing. + inline LokiAllocator( void ) throw() { } + + /// Copy constructor does nothing. + inline LokiAllocator( const LokiAllocator & ) throw() { } + + /// Type converting allocator constructor does nothing. + template < typename Type1 > + inline LokiAllocator( const LokiAllocator< Type1 > & ) throw() { } + + /// Destructor does nothing. + inline ~LokiAllocator() throw() { } + + /// Convert an allocator<Type> to an allocator <Type1>. + template < typename Type1 > + struct rebind + { + typedef LokiAllocator< Type1 > other; + }; + + /// Return address of reference to mutable element. + pointer address( reference elem ) const { return &elem; } + + /// Return address of reference to const element. + const_pointer address( const_reference elem ) const { return &elem; } + + /** Allocate an array of count elements. Warning! The true parameter in + the call to Allocate means this function can throw exceptions. This is + better than not throwing, and returning a null pointer in case the caller + assumes the return value is not null. + @param count # of elements in array. + @param hint Place where caller thinks allocation should occur. + @return Pointer to block of memory. + */ + pointer allocate( size_type count, const void * hint = 0 ) + { + (void)hint; // Ignore the hint. + void * p = AllocT::Instance().Allocate( count * sizeof( Type ), true ); + return reinterpret_cast< pointer >( p ); + } + + /// Ask allocator to release memory at pointer with size bytes. + void deallocate( pointer p, size_type size ) + { + AllocT::Instance().Deallocate( p, size * sizeof( Type ) ); + } + + /// Calculate max # of elements allocator can handle. + size_type max_size( void ) const throw() + { + // A good optimizer will see these calculations always produce the same + // value and optimize this function away completely. + const size_type max_bytes = size_type( -1 ); + const size_type bytes = max_bytes / sizeof( Type ); + return bytes; + } + + /// Construct an element at the pointer. + void construct( pointer p, const Type & value ) + { + // A call to global placement new forces a call to copy constructor. + ::new( p ) Type( value ); + } + + /// Destruct the object at pointer. + void destroy( pointer p ) + { + // If the Type has no destructor, then some compilers complain about + // an unreferenced parameter, so use the void cast trick to prevent + // spurious warnings. + (void)p; + p->~Type(); + } + +}; + +//----------------------------------------------------------------------------- + +/** All equality operators return true since LokiAllocator is basically a + monostate design pattern, so all instances of it are identical. + */ +template < typename Type > +inline bool operator == ( const LokiAllocator< Type > &, const LokiAllocator< Type > & ) +{ + return true; +} + +/** All inequality operators return false since LokiAllocator is basically a + monostate design pattern, so all instances of it are identical. + */ +template < typename Type > +inline bool operator != ( const LokiAllocator< Type > & , const LokiAllocator< Type > & ) +{ + return false; +} + +//----------------------------------------------------------------------------- + +} // namespace Loki + +#endif // LOKI_ALLOCATOR_INCLUDED Property changes on: trunk/include/loki/Allocator.h ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/include/loki/CheckReturn.h =================================================================== --- trunk/include/loki/CheckReturn.h 2008-08-08 22:06:26 UTC (rev 895) +++ trunk/include/loki/CheckReturn.h 2008-08-08 22:20:05 UTC (rev 896) @@ -1,96 +1,96 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2007 by Rich Sposato -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this -// permission notice appear in supporting documentation. -// The author makes no representations about the -// suitability of this software for any purpose. It is provided "as is" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// - -#ifndef LOKI_CHECK_RETURN_INC_ -#define LOKI_CHECK_RETURN_INC_ - -// $Id$ - - -#include <assert.h> - -namespace Loki -{ - -// ---------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// \class CheckReturn -/// -/// \par Purpose -/// C++ provides no mechanism within the language itself to force code to -/// check the return value from a function call. This simple class provides -/// a mechanism by which programmers can force calling functions to check the -/// return value. Or at least make them consciously choose to disregard the -/// return value. If the calling function fails to use or store the return -/// value, the destructor asserts. -/// -/// \par Return Type -/// The returned value is copied into CheckReturn rather than accessed via a -/// a reference or pointer since return value could be local to a function. -/// CheckReturn works best when the return type is a built-in primitive (bool, -/// int, etc...) a pointer, or an enum (such as an error condition enum). It -/// can work with other types that have cheap copy operations. -//////////////////////////////////////////////////////////////////////////////// - -template < class Value > -class CheckReturn -{ -public: - - /// Conversion constructor changes Value type to CheckReturn type. - inline CheckReturn( Value value ) : - m_value( value ), m_checked( false ) {} - - /// Copy-constructor allows functions to call another function within the - /// return statement. The other CheckReturn's m_checked flag is set since - /// its duty has been passed to the m_checked flag in this one. - inline CheckReturn( const CheckReturn & that ) : - m_value( that.m_value ), m_checked( false ) - { that.m_checked = true; } - - /// Destructor checks if return value was used. - inline ~CheckReturn( void ) - { - // If this assertion fails, then a function failed to check the - // return value from a function call. - assert( m_checked ); - } - - /// Conversion operator changes CheckReturn back to Value type. - inline operator Value ( void ) - { - m_checked = true; - return m_value; - } - -private: - /// Default constructor not implemented. - CheckReturn( void ); - - /// Copy-assignment operator not implemented. - CheckReturn & operator = ( const CheckReturn & that ); - - /// Copy of returned value. - Value m_value; - - /// Flag for whether calling function checked return value yet. - mutable bool m_checked; -}; - -// ---------------------------------------------------------------------------- - -} // namespace Loki - -#endif // end file guardian - -// $Log$ +//////////////////////////////////////////////////////////////////////////////// +// The Loki Library +// Copyright (c) 2007 by Rich Sposato +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this +// permission notice appear in supporting documentation. +// The author makes no representations about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. +//////////////////////////////////////////////////////////////////////////////// + +#ifndef LOKI_CHECK_RETURN_INC_ +#define LOKI_CHECK_RETURN_INC_ + +// $Id$ + + +#include <assert.h> + +namespace Loki +{ + +// ---------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// \class CheckReturn +/// +/// \par Purpose +/// C++ provides no mechanism within the language itself to force code to +/// check the return value from a function call. This simple class provides +/// a mechanism by which programmers can force calling functions to check the +/// return value. Or at least make them consciously choose to disregard the +/// return value. If the calling function fails to use or store the return +/// value, the destructor asserts. +/// +/// \par Return Type +/// The returned value is copied into CheckReturn rather than accessed via a +/// a reference or pointer since return value could be local to a function. +/// CheckReturn works best when the return type is a built-in primitive (bool, +/// int, etc...) a pointer, or an enum (such as an error condition enum). It +/// can work with other types that have cheap copy operations. +//////////////////////////////////////////////////////////////////////////////// + +template < class Value > +class CheckReturn +{ +public: + + /// Conversion constructor changes Value type to CheckReturn type. + inline CheckReturn( Value value ) : + m_value( value ), m_checked( false ) {} + + /// Copy-constructor allows functions to call another function within the + /// return statement. The other CheckReturn's m_checked flag is set since + /// its duty has been passed to the m_checked flag in this one. + inline CheckReturn( const CheckReturn & that ) : + m_value( that.m_value ), m_checked( false ) + { that.m_checked = true; } + + /// Destructor checks if return value was used. + inline ~CheckReturn( void ) + { + // If this assertion fails, then a function failed to check the + // return value from a function call. + assert( m_checked ); + } + + /// Conversion operator changes CheckReturn back to Value type. + inline operator Value ( void ) + { + m_checked = true; + return m_value; + } + +private: + /// Default constructor not implemented. + CheckReturn( void ); + + /// Copy-assignment operator not implemented. + CheckReturn & operator = ( const CheckReturn & that ); + + /// Copy of returned value. + Value m_value; + + /// Flag for whether calling function checked return value yet. + mutable bool m_checked; +}; + +// ---------------------------------------------------------------------------- + +} // namespace Loki + +#endif // end file guardian + +// $Log$ Property changes on: trunk/include/loki/CheckReturn.h ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/include/loki/Checker.h =================================================================== --- trunk/include/loki/Checker.h 2008-08-08 22:06:26 UTC (rev 895) +++ trunk/include/loki/Checker.h 2008-08-08 22:20:05 UTC (rev 896) @@ -1,453 +1,453 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// The Loki Library -// Copyright (c) 2008 Rich Sposato -// The copyright on this file is protected under the terms of the MIT license. -// -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this -// permission notice appear in supporting documentation. -// -// The author makes no representations about the suitability of this software -// for any purpose. It is provided "as is" without express or implied warranty. -// -//////////////////////////////////////////////////////////////////////////////// - -// $Id$ - -/// @file Checker.h This file provides Loki's Checker facility. - - -// ---------------------------------------------------------------------------- - -#ifndef LOKI_CHECKER_H_INCLUDED -#define LOKI_CHECKER_H_INCLUDED - -#include <exception> // needed for calls to uncaught_exception. -#include <assert.h> - - -namespace Loki -{ - -/** @par Checker and StaticChecker Overview - The Checker and StaticChecker classes have two purposes: - - provide a mechanism by which programmers can determine which functions - violate class/data invariants, - - and determine which exception safety a function provides. - - @par Class & Data Invariants - The Checker and StaticChecker utilities define invariants as "expressions that - are true for particular data". They uses a function which returns true if all - data are valid, and returns false if any datum is invalid. This is called the - validator function, and the host class or function provides a pointer to it. - The validator could also assert for any invariant which fails rather than - return false. If the validator is a static member function, you can use it - with checkers in any function, but especially standalone functions and class - static functions. If the validator is a non-static member function, you can - use it only within non-static member functions. - - @par Exception Safety Levels - Years ago, David Abrahams formalized a framework for assessing the exception - safety level a function provides. His framework describes three levels of - guarantees. Any function which does not provide any of these levels is - considered unsafe. Checker and StaticChecker determine a function's safety - level through the use of policy classes. Checker's policy classes can show if - a function provides any of these three guarantees. (Caveat: Checker can't - detect leaks directly by itself, but it can call a validator which does.) - StaticChecker's policy classes only provide direct checking for the no-throw - and invariant guarantees. With some finesse, a programmer can write a - validator for StaticChecker that checks for the Strong guarantee. - - - No-throw guarantee: A function will not throw any exceptions. - - Strong guarantee: A function will not change data if an exception occurs. - (Also called the no-change guarantee.) - - Basic guarantee: A function will not leak resources and data will remain - in a valid state if an exception occurs. (Also called a no-leak guarantee.) - */ - -// ---------------------------------------------------------------------------- - -/** @class CheckForNoThrow - - @par Exception Safety Level: - This exception-checking policy class for Checker asserts if an exception exists. - Host classes can use this to show that some member functions provide the no-throw - exception safety guarantees. - - @par Requirements For Host Class: - This policy imposes no requirements on a host class. - */ -template < class Host > -class CheckForNoThrow -{ -public: - - inline explicit CheckForNoThrow( const Host * ) {} - - inline void Check( const Host * ) const - { - assert( !::std::uncaught_exception() ); - } -}; - -// ---------------------------------------------------------------------------- - -/** @class CheckForNoChange - - @par Exception Safety Level: - This exception-checking policy class for Checker asserts only if a copy of the - host differs from the host object when an exception occurs. Host classes can - use this policy to show which member functions provide the strong exception - guarantee. - - @par Requirements: - This policy requires hosts to provide both the copy-constructor and the - equality operator, and is intended for classes with value semantics. - equality operator. - */ - -template < class Host > -class CheckForNoChange -{ -public: - - inline explicit CheckForNoChange( const Host * host ) : - m_compare( *host ) {} - - inline void Check( const Host * host ) const - { - if ( ::std::uncaught_exception() ) - { - assert( m_compare == *host ); - } - } - -private: - Host m_compare; -}; - -// ---------------------------------------------------------------------------- - -/** @class CheckForNoChangeOrThrow - - @par Exception Safety Level: - This exception-checking policy class for Checker asserts either if a copy of - the host differs from the original host object, or if an exception occurs. - Host classes can use this policy to show which member functions provide the - no-throw exception guarantee, and would never change data anyway. - - @par Requirements For Host Class: - This policy requires hosts to provide both the copy-constructor and the - equality operator, and is intended for classes with value semantics. - */ - -template < class Host > -class CheckForNoChangeOrThrow -{ -public: - - inline explicit CheckForNoChangeOrThrow( const Host * host ) : - m_compare( *host ) {} - - inline void Check( const Host * host ) const - { - assert( !::std::uncaught_exception() ); - assert( m_compare == *host ); - } - -private: - Host m_compare; -}; - -// ---------------------------------------------------------------------------- - -/** @class CheckForEquality - - @par Exception Safety Level: - This exception-checking policy class for Checker asserts only if a copy of the - host differs from the host object regardless of whether an exception occurs. - Host classes can use this policy to show which member functions never change - data members, and thereby provide the strong exception safety level by default. - - @par Requirements For Host Class: - This policy requires hosts to provide both the copy-constructor and the - equality operator, and is intended for classes with value semantics. - */ - -template < class Host > -class CheckForEquality -{ -public: - - inline explicit CheckForEquality( const Host * host ) : - m_compare( *host ) {} - - inline void Check( const Host * host ) const - { - assert( m_compare == *host ); - } - -private: - Host m_compare; -}; - -// ---------------------------------------------------------------------------- - -/** @class CheckForNothing - - @par Exception Safety Level: - This exception-checking policy class for Checker does nothing when called. - Host classes can use this to show which member functions provide neither the - strong nor no-throw exception guarantees. The best guarantee such functions - can provide is that nothing gets leaked. - - @par Requirements For Host Class: - This policy imposes no requirements on a host class. - */ - -template < class Host > -class CheckForNothing -{ -public: - inline explicit CheckForNothing( const Host * ) {} - inline void Check( const Host * ) const {} -}; - -// ---------------------------------------------------------------------------- - -/** @class Checker - This class checks if a host class violated an invariant. This asserts if any - check for an invariant failed. It can also demonstrate which functions provide - which exception safety level. - - @par Usage - -# Implement a function that checks each class invariant. The function must - have the signature similar to the Validator type. Something like: - "bool Host::IsValid( void ) const;" - - The function should return true if everything is okay, but false if - something is wrong. - - Or it could assert if anything is wrong. - -# Declare some typedef's inside the class declaration like these. Make one - typedef for each exception policy you use. I typedef'ed the CheckForNothing - policy as CheckInvariants because even if a function can't provide either the - no-throw nor the no-change policies, it should still make sure the object - remains in a valid state. - - typedef ::Loki::Checker< Host, ::Loki::CheckForNoThrow > CheckForNoThrow; - - typedef ::Loki::Checker< Host, ::Loki::CheckForNoChange > CheckForNoChange; - - typedef ::Loki::Checker< Host, ::Loki::CheckForEquality > CheckForEquality; - - typedef ::Loki::Checker< Host, ::Loki::CheckForNothing > CheckInvariants; - -# Construct a checker near the top of each member function - except in the - validator member function. Pass the this pointer and the address of your - validator function into the checker's constructor. - - If the function never throws, then use the CheckForNoThrow policy. - - If the function never changes any data members, then use CheckForEquality - policy. - - If the function's normal execution flow changes data, but must make sure - data remains unchanged when any exceptions occur, then use the - CheckForNoChange policy. - - Otherwise use the CheckInvariants policy. - -# Recompile a debug version of your program, run it, and look for which - assertions failed. - */ - -template -< - class Host, - template < class > class ExceptionPolicy -> -class Checker : public ExceptionPolicy< Host > -{ - /// Shorthand for the ExceptionPolicy class. - typedef ExceptionPolicy< Host > Ep; - -public: - - /// Signature for the validation function. - typedef bool ( Host:: * Validator )( void ) const; - - /** The constructor makes sure the host is valid at the time the checker - was created, thus insuring the host object was not corrupt from the start. - */ - inline Checker( const Host * host, Validator validator ) : - Ep( host ), - m_host( host ), - m_validator( validator ) - { - Check(); - } - - /** The destructor checks if any Host invariants failed, and then calls the - ExceptionPolicy's Check function to determine what to do in case of an - exception. - */ - inline ~Checker( void ) - { - Check(); - Ep::Check( m_host ); - } - - /** This first checks the invariants for Checker, and then calls the - validator function for the host to make sure no class invariants - were broken by the host within the Host's member function body. The - host member function can call Check directly to verify the object - remains valid at any time. - */ - inline void Check( void ) const - { - assert( 0 != this ); - assert( 0 != m_host ); - assert( 0 != m_validator ); - // Now that this confirms the pointers to the host and validation - // functions are not null, go ahead and validate the host object. - assert( ( m_host->*( m_validator ) )() ); - } - -private: - - /// Default constructor is not implemented. - Checker( void ); - /// Copy constructor is not implemented. - Checker( const Checker & ); - /// Copy-assignment operator is not implemented. - Checker & operator = ( const Checker & ); - - /// Pointer to the host object. - const Host * m_host; - - /// Pointer to member function that checks Host object's invariants. - Validator m_validator; -}; - -// ---------------------------------------------------------------------------- - -/** @class CheckStaticForNoThrow - - @par Exception Safety Level: - This exception-checking policy class for StaticChecker asserts if an exception - exists. Functions can use this to show they provide the no-throw exception - safety guarantee. - */ -class CheckStaticForNoThrow -{ -public: - static inline void Check( void ) - { - assert( !::std::uncaught_exception() ); - } -}; - -// ---------------------------------------------------------------------------- - -/** @class CheckStaticForNothing - - @par Exception Safety Level: - This exception-checking policy class for StaticChecker does nothing when called. - Functions can use this to show they might provide the weak exception guarantee. - The best guarantee such functions can provide is that nothing gets leaked. - */ -class CheckStaticForNothing -{ -public: - static inline void Check( void ) {} -}; - -// ---------------------------------------------------------------------------- - -/** @class StaticChecker - This class checks if a function provides the no-throw exception safety level - and if the function violated any invariants. Invariants for stand-alone and - static functions act as pre-conditions and post-conditions. - - @par Usage - -# Implement a function that checks the invariants associated with a function, - or with the static data for a class. The function must - have the signature similar to the Validator type. Something like: - "static bool Host::StaticIsValid( void );" or "bool IsOkay( void );" - - The function should return true if everything is okay, but false if - something is wrong. - - Or it could assert if anything is wrong. - -# If the checker is for static functions within a class, declare typedef's - inside the class declaration like these. Make one typedef for each policy - you use. I typedef'ed the CheckForNothing policy as CheckInvariants because - even if a function can't provide the no-throw guarantee, it should still - make sure that static data remains in a valid state. - - typedef ::Loki::StaticChecker< ::Loki::CheckForNoThrow > CheckStaticForNoThrow; - - typedef ::Loki::StaticChecker< ::Loki::CheckForNothing > CheckStaticInvariants; - -# Construct a checker near the top of each member function - except in the - validator member function. Pass the address of your validator function into - the checker's constructor. - - If the function never throws, then use the CheckForNoThrow policy. - - Otherwise use the CheckInvariants policy. - -# Recompile a debug version of your program, run it, and look for which - assertions failed. - */ - -template -< - class ExceptionPolicy -> -class StaticChecker : public ExceptionPolicy -{ - /// Shorthand for the ExceptionPolicy class. - typedef ExceptionPolicy Ep; - -public: - - /// Signature for the validation function. - typedef bool ( * Validator )( void ); - - /** The constructor makes sure the host is valid at the time the checker - was created, thus insuring the host object was not corrupt from the start. - */ - inline explicit StaticChecker( Validator validator ) : - Ep(), - m_validator( validator ) - { - Check(); - } - - /** The destructor checks if any Host invariants failed, and then calls the - ExceptionPolicy's Check function to determine what to do in case of an - exception. - */ - inline ~StaticChecker( void ) - { - Check(); - Ep::Check(); - } - - /** This first checks its own invariants, and then calls the validator - function to make sure no invariants were broken by the function which - created this checker. That function can call Check directly to verify - the data remains valid at any time. - */ - inline void Check( void ) const - { - assert( 0 != this ); - assert( 0 != m_validator ); - // Now that this confirms the pointers to the host and validation - // functions are not null, go ahead and validate the host object. - assert( ( m_validator )() ); - } - -private: - - /// Default constructor is not implemented. - StaticChecker( void ); - /// Copy constructor is not implemented. - StaticChecker( const StaticChecker & ); - /// Copy-assignment operator is not implemented. - StaticChecker & operator = ( const StaticChecker & ); - - /// Pointer to member function that checks Host object's invariants. - Validator m_validator; - -}; - -// ---------------------------------------------------------------------------- - -}; // end namespace Loki - -#endif +//////////////////////////////////////////////////////////////////////////////// +// +// The Loki Library +// Copyright (c) 2008 Rich Sposato +// The copyright on this file is protected under the terms of the MIT license. +// +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this +// permission notice appear in supporting documentation. +// +// The author makes no representations about the suitability of this software +// for any purpose. It is provided "as is" without express or implied warranty. +// +//////////////////////////////////////////////////////////////////////////////// + +// $Id$ + +/// @file Checker.h This file provides Loki's Checker facility. + + +// ---------------------------------------------------------------------------- + +#ifndef LOKI_CHECKER_H_INCLUDED +#define LOKI_CHECKER_H_INCLUDED + +#include <exception> // needed for calls to uncaught_exception. +#include <assert.h> + + +namespace Loki +{ + +/** @par Checker and StaticChecker Overview + The Checker and StaticChecker classes have two purposes: + - provide a mechanism by which programmers can determine which functions + violate class/data invariants, + - and determine which exception safety a function provides. + + @par Class & Data Invariants + The Checker and StaticChecker utilities define invariants as "expressions that + are true for particular data". They uses a function which returns true if all + data are valid, and returns false if any datum is invalid. This is called the + validator function, and the host class or function provides a pointer to it. + The validator could also assert for any invariant which fails rather than + return false. If the validator is a static member function, you can use it + with checkers in any function, but especially standalone functions and class + static functions. If the validator is a non-static member function, you can + use it only within non-static member functions. + + @par Exception Safety Levels + Years ago, David Abrahams formalized a framework for assessing the exception + safety level a function provides. His framework describes three levels of + guarantees. Any function which does not provide any of these levels is + considered unsafe. Checker and StaticChecker determine a function's safety + level through the use of policy classes. Checker's policy classes can show if + a function provides any of these three guarantees. (Caveat: Checker can't + detect leaks directly by itself, but it can call a validator which does.) + StaticChecker's policy classes only provide direct checking for the no-throw + and invariant guarantees. With some finesse, a programmer can write a + validator for StaticChecker that checks for the Strong guarantee. + + - No-throw guarantee: A function will not throw any exceptions. + - Strong guarantee: A function will not change data if an exception occurs. + (Also called the no-change guarantee.) + - Basic guarantee: A function will not leak resources and data will remain + in a valid state if an exception occurs. (Also called a no-leak guarantee.) + */ + +// ---------------------------------------------------------------------------- + +/** @class CheckForNoThrow + + @par Exception Safety Level: + This exception-checking policy class for Checker asserts if an exception exists. + Host classes can use this to show that some member functions provide the no-throw + exception safety guarantees. + + @par Requirements For Host Class: + This policy imposes no requirements on a host class. + */ +template < class Host > +class CheckForNoThrow +{ +public: + + inline explicit CheckForNoThrow( const Host * ) {} + + inline void Check( const Host * ) const + { + assert( !::std::uncaught_exception() ); + } +}; + +// ---------------------------------------------------------------------------- + +/** @class CheckForNoChange + + @par Exception Safety Level: + This exception-checking policy class for Checker asserts only if a copy of the + host differs from the host object when an exception occurs. Host classes can + use this policy to show which member functions provide the strong exception + guarantee. + + @par Requirements: + This policy requires hosts to provide both the copy-constructor and the + equality operator, and is intended for classes with value semantics. + equality operator. + */ + +template < class Host > +class CheckForNoChange +{ +public: + + inline explicit CheckForNoChange( const Host * host ) : + m_compare( *host ) {} + + inline void Check( const Host * host ) const + { + if ( ::std::uncaught_exception() ) + { + assert( m_compare == *host ); + } + } + +private: + Host m_compare; +}; + +// ---------------------------------------------------------------------------- + +/** @class CheckForNoChangeOrThrow + + @par Exception Safety Level: + This exception-checking policy class for Checker asserts either if a copy of + the host differs from the original host object, or if an exception occurs. + Host classes can use this policy to show which member functions provide the + no-throw exception guarantee, and would never change data anyway. + + @par Requirements For Host Class: + This policy requires hosts to provide both the copy-constructor and the + equality operator, and is intended for classes with value semantics. + */ + +template < class Host > +class CheckForNoChangeOrThrow +{ +public: + + inline explicit CheckForNoChangeOrThrow( const Host * host ) : + m_compare( *host ) {} + + inline void Check( const Host * host ) const + { + assert( !::std::uncaught_exception() ); + assert( m_compare == *host ); + } + +private: + Host m_compare; +}; + +// ---------------------------------------------------------------------------- + +/** @class CheckForEquality + + @par Exception Safety Level: + This exception-checking policy class for Checker asserts only if a copy of the + host differs from the host object regardless of whether an exception occurs. + Host classes can use this policy to show which member functions never change + data members, and thereby provide the strong exception safety level by default. + + @par Requirements For Host Class: + This policy requires hosts to provide both the copy-constructor and the + equality operator, and is intended for classes with value semantics. + */ + +template < class Host > +class CheckForEquality +{ +public: + + inline explicit CheckForEquality( const Host * host ) : + m_compare( *host ) {} + + inline void Check( const Host * host ) const + { + assert( m_compare == *host ); + } + +private: + Host m_compare; +}; + +// ---------------------------------------------------------------------------- + +/** @class CheckForNothing + + @par Exception Safety Level: + This exception-checking policy class for Checker does nothing when called. + Host classes can use this to show which member functions provide neither the + strong nor no-throw exception guarantees. The best guarantee such functions + can provide is that nothing gets leaked. + + @par Requirements For Host Class: + This policy imposes no requirements on a host class. + */ + +template < class Host > +class CheckForNothing +{ +public: + inline explicit CheckForNothing( const Host * ) {} + inline void Check( const Host * ) const {} +}; + +// ---------------------------------------------------------------------------- + +/** @class Checker + This class checks if a host class violated an invariant. This asserts if any + check for an invariant failed. It can also demonstrate which functions provide + which exception safety level. + + @par Usage + -# Implement a function that checks each class invariant. The function must + have the signature similar to the Validator type. Something like: + "bool Host::IsValid( void ) const;" + - The function should return true if everything is okay, but false if + something is wrong. + - Or it could assert if anything is wrong. + -# Declare some typedef's inside the class declaration like these. Make one + typedef for each exception policy you use. I typedef'ed the CheckForNothing + policy as CheckInvariants because even if a function can't provide either the + no-throw nor the no-change policies, it should still make sure the object + remains in a valid state. + - typedef ::Loki::Checker< Host, ::Loki::CheckForNoThrow > CheckForNoThrow; + - typedef ::Loki::Checker< Host, ::Loki::CheckForNoChange > CheckForNoChange; + - typedef ::Loki::Checker< Host, ::Loki::CheckForEquality > CheckForEquality; + - typedef ::Loki::Checker< Host, ::Loki::CheckForNothing > CheckInvariants; + -# Construct a checker near the top of each member function - except in the + validator member function. Pass the this pointer and the address of your + validator function into the checker's constructor. + - If the function never throws, then use the CheckForNoThrow policy. + - If the function never changes any data members, then use CheckForEquality + policy. + - If the function's normal execution flow changes data, but must make sure + data remains unchanged when any exceptions occur, then use the + CheckForNoChange policy. + - Otherwise use the CheckInvariants policy. + -# Recompile a debug version of your program, run it, and look for which + assertions failed. + */ + +template +< + class Host, + template < class > class ExceptionPolicy +> +class Checker : public ExceptionPolicy< Host > +{ + /// Shorthand for the ExceptionPolicy class. + typedef ExceptionPolicy< Host > Ep; + +public: + + /// Signature for the validation function. + typedef bool ( Host:: * Validator )( void ) const; + + /** The constructor makes sure the host is valid at the time the checker + was created, thus insuring the host object was not corrupt from the start. + */ + inline Checker( const Host * host, Validator validator ) : + Ep( host ), + m_host( host ), + m_validator( validator ) + { + Check(); + } + + /** The destructor checks if any Host invariants failed, and then calls the + ExceptionPolicy's Check function to determine what to do in case of an + exception. + */ + inline ~Checker( void ) + { + Check(); + Ep::Check( m_host ); + } + + /** This first checks the invariants for Checker, and then calls the + validator function for the host to make sure no class invariants + were broken by the host within the Host's member function body. The + host member function can call Check directly to verify the object + remains valid at any time. + */ + inline void Check( void ) const + { + assert( 0 != this ); + assert( 0 != m_host ); + assert( 0 != m_validator ); + // Now that this confirms the pointers to the host and validation + // functions are not null, go ahead and validate the host object. + assert( ( m_host->*( m_validator ) )() ); + } + +private: + + /// Default constructor is not implemented. + Checker( void ); + /// Copy constructor is not implemented. + Checker( const Checker & ); + /// Copy-assignment operator is not implemented. + Checker & operator = ( const Checker & ); + + /// Pointer to the host object. + const Host * m_host; + + /// Pointer to member function that checks Host object's invariants. + Validator m_validator; +}; + +// ---------------------------------------------------------------------------- + +/** @class CheckStaticForNoThrow + + @par Exception Safety Level: + This exception-checking policy class for StaticChecker asserts if an exception + exists. Functions can use this to show they provide the no-throw exception + safety guarantee. + */ +class CheckStaticForNoThrow +{ +public: + static inline void Check( void ) + { + assert( !::std::uncaught_exception() ); + } +}; + +// ---------------------------------------------------------------------------- + +/** @class CheckStaticForNothing + + @par Exception Safety Level: + This exception-checking policy class for StaticChecker does nothing when called. + Functions can use this to show they might provide the weak exception guarantee. + The best guarantee such functions can provide is that nothing gets leaked. + */ +class CheckStaticForNothing +{ +public: + static inline void Check( void ) {} +}; + +// ---------------------------------------------------------------------------- + +/** @class StaticChecker + This class checks if a function provides the no-throw exception safety level + and if the function violated any invariants. Invariants for stand-alone and + static functions act as pre-conditions and post-conditions. + + @par Usage + -# Implement a function that checks the invariants associated with a function, + or with the static data for a class. The function must + have the signature similar to the Validator type. Something like: + "static bool Host::StaticIsValid( void );" or "bool IsOkay( void );" + - The function should return true if everything is okay, but false if + something is wrong. + - Or it could assert if anything is wrong. + -# If the checker is for static functions within a class, declare typedef's + inside the class declaration like these. Make one typedef for each policy + you use. I typedef'ed the CheckForNothing policy as CheckInvariants because + even if a function can't provide the no-throw guarantee, it should still + make sure that static data remains in a valid state. + - typedef ::Loki::StaticChecker< ::Loki::CheckForNoThrow > CheckStaticForNoThrow; + - typedef ::Loki::StaticChecker< ::Loki::CheckForNothing > CheckStaticInvariants; + -# Construct a checker near the top of each member function - except in the + validator member function. Pass the address of your validator function into + the checker's constructor. + - If the function never throws, then use the CheckForNoThrow policy. + - Otherwise use the CheckInvariants policy. + -# Recompile a debug version of your program, run it, and look for which + assertions failed. + */ + +template +< + class ExceptionPolicy +> +class StaticChecker : public ExceptionPolicy +{ + /// Shorthand for the ExceptionPolicy class. + typedef ExceptionPolicy Ep; + +public: + + /// Signature for the validation function. + typedef bool ( * Validator )( void ); + + /** The constructor makes sure the host is valid at the time the checker + was created, thus insuring the host object was not corrupt from the start. + */ + inline explicit StaticChecker( Validator validator ) : + Ep(), + m_validator( validator ) + { + Check(); + } + + /** The destructor checks if any Host invariants failed, and then calls the + ExceptionPolicy's Check function to determine what to do in case of an + exception. + */ + inline ~StaticChecker( void ) + { + Check(); + Ep::Check(); + } + + /** This first checks its own invariants, and then calls the validator + function to make sure no invariants were broken by the function which + created this checker. That function can call Check directly to verify + the data remains valid at any time. + */ + inline void Check( void ) const + { + assert( 0 != this ); + assert( 0 != m_validator ); + // Now that this confirms the pointers to the host and validation + // functions are not null, go ahead and validate the host object. + assert( ( m_validator )() ); + } + +private: + + /// Default constructor is not implemented. + StaticChecker( void ); + /// Copy constructor is not implemented. + StaticChecker( const StaticChecker & ); + /// Copy-assignment operator is not implemented. + StaticChecker & operator = ( const StaticChecker & ); + + /// Pointer to member function that checks Host object's invariants. + Validator m_validator; + +}; + +// ---------------------------------------------------------------------------- + +}; // end namespace Loki + +#endif Property changes on: trunk/include/loki/Checker.h ___________________________________________________________________ Added: svn:eol-style + native Property changes on: trunk/include/loki/LevelMutex.h ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/include/loki/SPCachedFactory.h =================================================================== --- trunk/include/loki/SPCachedFactory.h 2008-08-08 22:06:26 UTC (rev 895) +++ trunk/include/loki/SPCachedFactory.h 2008-08-08 22:20:05 UTC (rev 896) @@ -1,204 +1,204 @@ -//////////////////////////////////////////////////////////////////////////////// -// The Loki Library -// Copyright (c) 2006 by Guillaume Chatelet -// -// Code covered by the MIT License -// -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this -// permission notice appear in supporting documentation. -// -// The authors make no representations about the suitability of this software -// for any purpose. It is provided "as is" without express or implied warranty. -// -// This code DOES NOT accompany the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design -// Patterns Applied". Copyright (c) 2001. Addison-Wesley. -// -//////////////////////////////////////////////////////////////////////////////// - -// $Id$ - -#ifndef SPCACHEDFACTORY_H_ -#define SPCACHEDFACTORY_H_ - -/** - * This file is intented to be used if you want a CachedFactory with - * a SmartPointer encapsulation policy. - * It as been defined in a separate file because of the many introduced - * dependencies (SmartPtr.h would depend on Functor.h and CachedFactory.h - * would depend on SmartPtr.h). By defining another header you pay for those - * extra dependencies only if you need it. - * - * This file defines FunctionStorage a new SmartPointer storage policy and - * SmartPointer a new CachedFactory encapsulation policy. - */ - -#include <loki/Functor.h> -#include <loki/SmartPtr.h> -#include <loki/CachedFactory.h> - -namespace Loki -{ - -//////////////////////////////////////////////////////////////////////////////// -/// \class FunctionStorage -/// -/// \ingroup SmartPointerStorageGroup -/// \brief Implementation of the StoragePolicy used by SmartPtr. -/// -/// This storage policy is used by SmartPointer CachedFactory's encapsulation -/// policy. It's purpose is to call a Functor instead of deleting the -/// underlying pointee object. You have to set the callback functor by calling -/// SetCallBackFunction(const FunctorType &functor). -/// -/// Unfortunately, the functor argument is not a reference to the SmartPtr but -/// a void *. Making functor argument a reference to the pointer would require -/// the FunctionStorage template to know the full definition of the SmartPtr. -//////////////////////////////////////////////////////////////////////////////// - - template <class T> - class FunctionStorage - { - public: - /// the type of the pointee_ object - typedef T* StoredType; - /// type used to declare OwnershipPolicy type. - typedef T* InitPointerType; - /// type returned by operator-> - typedef T* PointerType; - /// type returned by operator* - typedef T& ReferenceType; - /// type of the Functor to set - typedef Functor< void , Seq< void* > > FunctorType; - - FunctionStorage() : pointee_(Default()), functor_() - {} - - // The storage policy doesn't initialize the stored pointer - // which will be initialized by the OwnershipPolicy's Clone fn - FunctionStorage(const FunctionStorage& rsh) : pointee_(0), functor_(rsh.functor_) - {} - - template <class U> - FunctionStorage(const FunctionStorage<U>& rsh) : pointee_(0), functor_(rsh.functor_) - {} - - FunctionStorage(const StoredType& p) : pointee_(p), functor_() {} - - PointerType operator->() const { return pointee_; } - - ReferenceType operator*() const { return *pointee_; } - - void Swap(FunctionStorage& rhs) - { - std::swap(pointee_, rhs.pointee_); - std::swap(functor_, rhs.functor_); - } - - /// Sets the callback function to call. You have to specify it or - /// the smartPtr will throw a bad_function_call exception. - void SetCallBackFunction(const FunctorType &functor) - { - functor_ = functor; - } - - // Accessors - template <class F> - friend typename FunctionStorage<F>::PointerType GetImpl(const FunctionStorage<F>& sp); - - template <class F> - friend const typename FunctionStorage<F>::StoredType& GetImplRef(const FunctionStorage<F>& sp); - - template <class F> - friend typename FunctionStorage<F>::StoredType& GetImplRef(FunctionStorage<F>& sp); - - protected: - // Destroys the data stored - // (Destruction might be taken over by the OwnershipPolicy) - void Destroy() - { - functor_(this); - } - - // Default value to initialize the pointer - static StoredType Default() - { return 0; } - - private: - // Data - StoredType pointee_; - FunctorType functor_; - }; - - template <class T> - inline typename FunctionStorage<T>::PointerType GetImpl(const FunctionStorage<T>& sp) - { return sp.pointee_; } - - template <class T> - ... [truncated message content] |
From: <syn...@us...> - 2008-08-08 22:53:23
|
Revision: 897 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=897&view=rev Author: syntheticpp Date: 2008-08-08 22:53:19 +0000 (Fri, 08 Aug 2008) Log Message: ----------- GCC 4.3 fixes: at least compile Modified Paths: -------------- trunk/include/loki/SafeFormat.h trunk/test/CachedFactory/CachedFactoryTest.cpp trunk/test/RegressionTest/AssocVectorTest.h trunk/test/SmartPtr/main.cpp Modified: trunk/include/loki/SafeFormat.h =================================================================== --- trunk/include/loki/SafeFormat.h 2008-08-08 22:20:05 UTC (rev 896) +++ trunk/include/loki/SafeFormat.h 2008-08-08 22:53:19 UTC (rev 897) @@ -24,6 +24,7 @@ #include <cstdio> #include <climits> #include <string> +#include <string> #include <stdexcept> #include <utility> #include <cassert> Modified: trunk/test/CachedFactory/CachedFactoryTest.cpp =================================================================== --- trunk/test/CachedFactory/CachedFactoryTest.cpp 2008-08-08 22:20:05 UTC (rev 896) +++ trunk/test/CachedFactory/CachedFactoryTest.cpp 2008-08-08 22:53:19 UTC (rev 897) @@ -25,6 +25,7 @@ #include <cassert> #include <iostream> +#include <cstring> #include <loki/Factory.h> #ifdef LOKI_DISABLE_TYPELIST_MACROS Modified: trunk/test/RegressionTest/AssocVectorTest.h =================================================================== --- trunk/test/RegressionTest/AssocVectorTest.h 2008-08-08 22:20:05 UTC (rev 896) +++ trunk/test/RegressionTest/AssocVectorTest.h 2008-08-08 22:53:19 UTC (rev 897) @@ -18,6 +18,7 @@ #include <cstdio> #include <cstdlib> +#include <cstring> #include <ctime> #include <loki/AssocVector.h> #include "UnitTest.h" Modified: trunk/test/SmartPtr/main.cpp =================================================================== --- trunk/test/SmartPtr/main.cpp 2008-08-08 22:20:05 UTC (rev 896) +++ trunk/test/SmartPtr/main.cpp 2008-08-08 22:53:19 UTC (rev 897) @@ -18,6 +18,7 @@ #include <loki/SmartPtr.h> #include <iostream> +#include <cstring> #include "base.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <syn...@us...> - 2008-08-09 15:35:15
|
Revision: 898 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=898&view=rev Author: syntheticpp Date: 2008-08-09 15:35:12 +0000 (Sat, 09 Aug 2008) Log Message: ----------- GCC 4.3 fixes, thanks to Tom Browder Modified Paths: -------------- trunk/include/loki/CachedFactory.h trunk/include/loki/LevelMutex.h trunk/include/loki/SafeFormat.h trunk/test/OrderedStatic/main.cpp Modified: trunk/include/loki/CachedFactory.h =================================================================== --- trunk/include/loki/CachedFactory.h 2008-08-08 22:53:19 UTC (rev 897) +++ trunk/include/loki/CachedFactory.h 2008-08-09 15:35:12 UTC (rev 898) @@ -516,7 +516,7 @@ { if(m_vKeys.empty()) throw EvictionException(); - size_type random = static_cast<size_type>((m_vKeys.size()*rand())/int(RAND_MAX + 1)); + size_type random = static_cast<size_type>((m_vKeys.size()*rand())/(static_cast<size_type>(RAND_MAX) + 1)); remove(*(m_vKeys.begin()+random)); } const char* name(){return "random";} Modified: trunk/include/loki/LevelMutex.h =================================================================== --- trunk/include/loki/LevelMutex.h 2008-08-08 22:53:19 UTC (rev 897) +++ trunk/include/loki/LevelMutex.h 2008-08-09 15:35:12 UTC (rev 898) @@ -34,6 +34,9 @@ #include <pthread.h> #endif +#if !defined(_WIN32) && !defined(_WIN64) + #include <unistd.h> // declares sleep under Linux +#endif /** @par thread_local Keyword The mutexes require compilers to provide thread local storage - meaning each Modified: trunk/include/loki/SafeFormat.h =================================================================== --- trunk/include/loki/SafeFormat.h 2008-08-08 22:53:19 UTC (rev 897) +++ trunk/include/loki/SafeFormat.h 2008-08-09 15:35:12 UTC (rev 898) @@ -24,7 +24,7 @@ #include <cstdio> #include <climits> #include <string> -#include <string> +#include <cstring> #include <stdexcept> #include <utility> #include <cassert> @@ -207,7 +207,7 @@ result_ = -1; return *this; } - const size_t len = std::min(strlen(s), prec_); + const size_t len = std::min(std::strlen(s), prec_); if (width_ > len) { if (LeftJustify()) { Write(s, s + len); @@ -397,15 +397,8 @@ const Char hex1st = uppercase ? 'A' : 'a'; for (;;) { const LOKI_SAFEFORMAT_UNSIGNED_LONG next = n / base; -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable: 4244) -#endif - Char c = n - next * base; -#ifdef _MSC_VER -#pragma warning(pop) -#endif - c += (c <= 9) ? '0' : hex1st - 10; + Char c = static_cast<Char>(n - next * base); + c += (c <= static_cast<Char>(9)) ? '0' : static_cast<Char>(hex1st - 10); *bufLast = c; n = next; if (n == 0) break; Modified: trunk/test/OrderedStatic/main.cpp =================================================================== --- trunk/test/OrderedStatic/main.cpp 2008-08-08 22:53:19 UTC (rev 897) +++ trunk/test/OrderedStatic/main.cpp 2008-08-09 15:35:12 UTC (rev 898) @@ -74,7 +74,7 @@ Loki::OrderedStatic<2,L2> l2; Loki::OrderedStatic<1, std::string, std::string(*)() > s1( &func ); -Loki::OrderedStatic<2, std::string, Loki::Seq<char *> > s2( "s2" ); +Loki::OrderedStatic<2, std::string, Loki::Seq<const char *> > s2( "s2" ); Loki::OrderedStatic<1, Loki::Functor<int>, Loki::Seq<int(*)()> > f1(f); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jfb...@us...> - 2009-03-17 18:21:53
|
Revision: 1011 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=1011&view=rev Author: jfbastien Date: 2009-03-17 18:21:12 +0000 (Tue, 17 Mar 2009) Log Message: ----------- Bug 2690414: flex_string missing swap implementation Modified Paths: -------------- trunk/include/loki/flex/flex_string_shell.h trunk/test/flex_string/main.cpp Modified: trunk/include/loki/flex/flex_string_shell.h =================================================================== --- trunk/include/loki/flex/flex_string_shell.h 2009-03-13 15:17:59 UTC (rev 1010) +++ trunk/include/loki/flex/flex_string_shell.h 2009-03-17 18:21:12 UTC (rev 1011) @@ -1305,8 +1305,12 @@ const flex_string<E, T, A, S>& rhs) { return !(lhs < rhs); } -// subclause 21.3.7.8: -//void swap(flex_string<E, T, A, S>& lhs, flex_string<E, T, A, S>& rhs); // to do +template <typename E, class T, class A, class S> +inline void swap(flex_string<E, T, A, S>& lhs, flex_string<E, T, A, S>& rhs) +{ + // 21.3.7.8 + lhs.swap(rhs); +} template <typename E, class T, class A, class S> std::basic_istream<typename flex_string<E, T, A, S>::value_type, Modified: trunk/test/flex_string/main.cpp =================================================================== --- trunk/test/flex_string/main.cpp 2009-03-13 15:17:59 UTC (rev 1010) +++ trunk/test/flex_string/main.cpp 2009-03-17 18:21:12 UTC (rev 1011) @@ -515,7 +515,7 @@ template<class String> String swap_string_string() { - using std::swap; + // 21.3.7.8 String random1(RandomString<String>(MaxString<String>::value)); String random2(RandomString<String>(MaxString<String>::value)); swap(random1, random2); @@ -525,7 +525,7 @@ template<class String> String swap_string_string__self() { - using std::swap; + // 21.3.7.8 String random1(RandomString<String>(MaxString<String>::value)); swap(random1, random1); return random1; @@ -534,7 +534,7 @@ template<class String> String swap_string_string__selfcopy() { - using std::swap; + // 21.3.7.8 String random1(RandomString<String>(MaxString<String>::value)); String copy(random1); swap(random1, copy); @@ -544,7 +544,7 @@ template<class String> String swap_string_string__selfcopy2() { - using std::swap; + // 21.3.7.8 String random1(RandomString<String>(MaxString<String>::value)); String copy(random1); swap(copy, random1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-03-31 21:56:20
|
Revision: 1012 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=1012&view=rev Author: rich_sposato Date: 2009-03-31 21:56:08 +0000 (Tue, 31 Mar 2009) Log Message: ----------- Added structs to declare typedefs for various exception policies. Modified Paths: -------------- trunk/include/loki/Checker.h trunk/test/Checker/main.cpp Modified: trunk/include/loki/Checker.h =================================================================== --- trunk/include/loki/Checker.h 2009-03-17 18:21:12 UTC (rev 1011) +++ trunk/include/loki/Checker.h 2009-03-31 21:56:08 UTC (rev 1012) @@ -39,7 +39,7 @@ @par Class & Data Invariants The ContractChecker and StaticChecker define invariants as "expressions that - are true for particular data". They uses a function which returns true if all + are true for particular data". They call a function which returns true if all data are valid, and returns false if any datum is invalid. This is called the validator function, and the host class or function provides a pointer to it. The validator could also assert for any invariant which fails rather than @@ -67,6 +67,40 @@ - Basic guarantee: A function will not leak resources and data will remain in a valid state if an exception occurs. (Which I call either the no-leak or no-break guarantee depending on context.) + + @par Writing Your Own Policies + Loki provides several exception policies for ContractChecker. These policies + assert if an object changed or a function threw an exception. If you prefer + policies that log failures to a file, pop-up a message box, notify your unit- + test framework, or whatever else, you can easily write your own policies. + Your policy class should have two functions, a constructor and a Check + function, both of which accept a pointer to const instance of the host class. + Your policy class will become a base class of ContractChecker. Check should + return true if all is okay, and false if any failure was detected. Check + should never throw any exceptions since it is called from ContractChecker's + destructor. You may add other functions to the policy class. This code + snippet shows the signatures for the two required functions. + @code + class YourPolicy + { public: + explicit YourPolicy( const Host * ); + bool Check( const Host * ) const; + } + @endcode + Loki provides two exception policies for StaticChecker - one that asserts if + an exception occurred, and one that does not care about exceptions. You can + make your own policy to log failures, send an email, file a bug report, or do + whatever. Just write a policy with a default constructor and a function call + Check which look like those shown below. Make sure your Check function never + throws any exceptions. Any additional functions or features of the policy + are up to you. + @code + class YourPolicy + { public: + YourPolicy(); + bool Check() const; + } + @endcode */ // ---------------------------------------------------------------------------- @@ -81,6 +115,7 @@ @par Requirements For Host Class: This policy imposes no requirements on a host class. */ + template < class Host > class CheckForNoThrow { @@ -173,7 +208,8 @@ /** @class CheckForEquality @par Exception Safety Level: - This exception-checking policy class for ContractChecker asserts if a copy of the host differs from the host object regardless of whether an exception occurs. + This exception-checking policy class for ContractChecker asserts if a copy of + the host differs from the host object regardless of whether an exception occurs. Host classes can use this policy to show which member functions never change data members, and thereby provide the strong exception safety level by default. @@ -241,23 +277,23 @@ something is wrong. - Or it could assert if anything is wrong. - Ideally, it should be private. - -# Implement similar functions to check for pre-conditions and post-conditions. - Functions which verify pre-conditions and post-conditions do not need to - check all class invariants, just conditions specific to certain public - functions in the host class. - -# Declare some typedef's inside the class declaration like these. Make one - typedef for each exception policy you use. I typedef'ed the CheckForNothing - policy as CheckInvariants because even if a function can't provide either the - no-throw nor the no-change policies, it should still make sure the object - remains in a valid state. - - typedef ::Loki::ContractChecker< Host, ::Loki::CheckForNoThrow > CheckForNoThrow; - - typedef ::Loki::ContractChecker< Host, ::Loki::CheckForNoChange > CheckForNoChange; - - typedef ::Loki::ContractChecker< Host, ::Loki::CheckForEquality > CheckForEquality; - - typedef ::Loki::ContractChecker< Host, ::Loki::CheckForNothing > CheckInvariants; - -# Construct a checker near the top of each member function - except in the - validator member function. Pass the this pointer and the address of your - validator function into the checker's constructor. You may also pass in pointers - to function which check pre- and post-conditions. + - It should never throw an exception. + -# Optionally implement similar functions to check for pre-conditions and post- + conditions. Functions which verify pre-conditions and post-conditions do + not need to check all class invariants, just conditions specific to certain + public functions in the host class. The post-condition function should never + throw exceptions. + -# Add this line in the class declaration: + - typedef ::Loki::CheckFor< Host > CheckFor; + -# Add one of these lines at the top of various class member functions to + construct a checker near the top of each public function. You may also pass + in pointers to functions which check pre- and post-conditions. + - CheckFor::NoChangeOrThrow checker( this, &Host::IsValid ); + - CheckFor::NoThrow checker( this, &Host::IsValid ); + - CheckFor::NoChange checker( this, &Host::IsValid ); + - CheckFor::Equality checker( this, &Host::IsValid ); + - CheckFor::Invariants checker( this, &Host::IsValid ); + -# Use these guidelines to decide which policy to use inside which function: - If the function never throws, then use the CheckForNoThrow policy. - If the function never changes any data members, then use CheckForEquality policy. @@ -362,6 +398,26 @@ // ---------------------------------------------------------------------------- +/** @struct CheckFor + This struct declares types of checkers used to validate a host object. All of + Loki's exception-checking policies are named here as typedef's so host classes + have a one-stop convenience place for declaring them. If you write your own + exception policies for ContractChecker, you might want to also write a struct + similiar to CheckFor to conveniently declare all your policies. + */ +template < class Host > +struct CheckFor +{ + // These lines declare checkers for non-static functions in a host class. + typedef ContractChecker< Host, CheckForNoChangeOrThrow > NoChangeOrThrow; + typedef ContractChecker< Host, CheckForNoThrow > NoThrow; + typedef ContractChecker< Host, CheckForNoChange > NoChange; + typedef ContractChecker< Host, CheckForEquality > Equality; + typedef ContractChecker< Host, CheckForNothing > Invariants; +}; + +// ---------------------------------------------------------------------------- + /** @class CheckStaticForNoThrow @par Exception Safety Level: @@ -410,18 +466,25 @@ - The function should return true if everything is okay, but false if something is wrong. - Or it could assert if anything is wrong. - -# If the checker is for static functions within a class, declare typedef's - inside the class declaration like these. Make one typedef for each policy - you use. I typedef'ed the CheckForNothing policy as CheckInvariants because - even if a function can't provide the no-throw guarantee, it should still - make sure that static data remains in a valid state. - - typedef ::Loki::StaticChecker< ::Loki::CheckForNoThrow > CheckStaticForNoThrow; - - typedef ::Loki::StaticChecker< ::Loki::CheckForNothing > CheckStaticInvariants; - -# Construct a checker near the top of each member function - except in the - validator member function. Pass the address of your validator function into - the checker's constructor. + - But it should never throw an exception. + -# If the checker validates static functions within a class, add this line to + the class declaration. + - typedef ::Loki::CheckStaticFor CheckStaticFor; + -# Construct a checker near the top of each member function using one of + these lines: + - CheckStaticFor::NoThrow checker( &Host::StaticIsValid ); + - CheckStaticFor::Invariants checker( &Host::StaticIsValid ); + -# These guidelines can help you decide which exception policy to use within + each function. - If the function never throws, then use the CheckForNoThrow policy. - Otherwise use the CheckInvariants policy. + -# If the checker validates standalone functions, then just add one of these + lines at the top of the function. You may also want to write validation + functions which check pre-conditions and post-conditions of standalone + functions which you can pass into the checker as optional 2nd and 3rd + parameters. + - ::Loki::CheckStaticFor::NoThrow checker( &AllIsValid ); + - ::Loki::CheckStaticFor::Invariants checker( &AllIsValid ); -# Recompile a debug version of your program, run it, and see if an assertion fails. */ @@ -511,6 +574,24 @@ // ---------------------------------------------------------------------------- +/** @struct CheckStaticFor + This struct declares types of checkers used to validate standalone functions + and class static functions. All of Loki's exception-checking policies for + StaticChecker are named here as typedef's. If you write your own + exception policies for StaticChecker, you might want to also write a struct + similiar to CheckStaticFor to conveniently declare all your policies. + */ +struct CheckStaticFor +{ + // These lines declare checkers for static functions of a host class + // or for standalone functions outside any class or struct. + typedef StaticChecker< CheckStaticForNoThrow > NoThrow; + typedef StaticChecker< CheckStaticForNothing > Invariants; + +}; + +// ---------------------------------------------------------------------------- + }; // end namespace Loki #endif Modified: trunk/test/Checker/main.cpp =================================================================== --- trunk/test/Checker/main.cpp 2009-03-17 18:21:12 UTC (rev 1011) +++ trunk/test/Checker/main.cpp 2009-03-31 21:56:08 UTC (rev 1012) @@ -92,16 +92,11 @@ /// This can be used to validate pre-conditions and post-conditions. bool IsValidFull( void ) const; - // These lines show how to declare checkers for non-static functions in a host class. - typedef ::Loki::ContractChecker< Thingy, ::Loki::CheckForNoThrow > CheckForNoThrow; - typedef ::Loki::ContractChecker< Thingy, ::Loki::CheckForNoChangeOrThrow > CheckForNoChangeOrThrow; - typedef ::Loki::ContractChecker< Thingy, ::Loki::CheckForNoChange > CheckForNoChange; - typedef ::Loki::ContractChecker< Thingy, ::Loki::CheckForEquality > CheckForEquality; - typedef ::Loki::ContractChecker< Thingy, ::Loki::CheckForNothing > CheckInvariants; + // This shows how to declare checkers for non-static functions in a host class. + typedef ::Loki::CheckFor< Thingy > CheckFor; - // These lines show how to declare checkers for static functions of a host class. - typedef ::Loki::StaticChecker< ::Loki::CheckStaticForNoThrow > CheckStaticForNoThrow; - typedef ::Loki::StaticChecker< ::Loki::CheckStaticForNothing > CheckStaticInvariants; + // This shows how to declare checkers for static functions of a host class. + typedef ::Loki::CheckStaticFor CheckStaticFor; typedef ::std::vector< unsigned int > IntBlock; @@ -120,7 +115,7 @@ // This example shows how static functions can use a no-throw checkers. void Thingy::ChangeThat( void ) { - CheckStaticForNoThrow checker( &Thingy::StaticIsValid ); + CheckStaticFor::NoThrow checker( &Thingy::StaticIsValid ); (void)checker; s_value--; } @@ -130,7 +125,7 @@ // This example shows how static functions can use an invariant checker. unsigned int Thingy::GetThat( void ) { - CheckStaticInvariants checker( &Thingy::StaticIsValid ); + CheckStaticFor::Invariants checker( &Thingy::StaticIsValid ); (void)checker; return s_value; } @@ -142,7 +137,7 @@ m_value( value ), m_counts() { - CheckInvariants checker( this, &Thingy::IsValid ); + CheckFor::Invariants checker( this, &Thingy::IsValid ); (void)checker; } @@ -152,7 +147,7 @@ m_value( that.m_value ), m_counts( that.m_counts ) { - CheckInvariants checker( this, &Thingy::IsValid ); + CheckFor::Invariants checker( this, &Thingy::IsValid ); (void)checker; } @@ -160,7 +155,7 @@ Thingy & Thingy::operator = ( const Thingy & that ) { - CheckInvariants checker( this, &Thingy::IsValid ); + CheckFor::Invariants checker( this, &Thingy::IsValid ); (void)checker; if ( &that != this ) { @@ -184,9 +179,9 @@ // A swap function gets 2 checkers - one for this, and another for that. void Thingy::Swap( Thingy & that ) { - CheckInvariants checker1( this, &Thingy::IsValid ); + CheckFor::Invariants checker1( this, &Thingy::IsValid ); (void)checker1; - CheckInvariants checker2( &that, &Thingy::IsValid ); + CheckFor::Invariants checker2( &that, &Thingy::IsValid ); (void)checker2; const IntBlock counts( m_counts ); @@ -216,7 +211,7 @@ // This example shows how to use the no-throw checker. unsigned int Thingy::GetValue( void ) const { - CheckForNoThrow checker( this, &Thingy::IsValid ); + CheckFor::NoThrow checker( this, &Thingy::IsValid ); (void)checker; return m_value; } @@ -226,7 +221,7 @@ // This example shows how to use the equality checker. unsigned int Thingy::DoSomething( bool doThrow ) const { - CheckForEquality checker( this, &Thingy::IsValid ); + CheckFor::Equality checker( this, &Thingy::IsValid ); (void)checker; if ( doThrow ) throw ::std::logic_error( "Test Exception." ); @@ -238,7 +233,7 @@ // This example shows how to use the no-change checker. void Thingy::DoSomethingElse( void ) const { - CheckForNoChange checker( this, &Thingy::IsValid ); + CheckFor::NoChange checker( this, &Thingy::IsValid ); (void)checker; } @@ -250,7 +245,7 @@ // but does not need to check pre-conditions, so it passes in a nullptr for // the pre-condition validator. Ths post-condition validator just makes sure // the container has at least 1 element. - CheckInvariants checker( this, &Thingy::IsValid, nullptr, &Thingy::IsValidFull ); + CheckFor::Invariants checker( this, &Thingy::IsValid, nullptr, &Thingy::IsValidFull ); m_counts.push_back( count ); } @@ -261,7 +256,7 @@ // This function's checker cares about class invariants and both the pre- and // post-conditions, so it passes in pointers for all 3 validators. The pre- // and post-conditions are both about making sure the container is not empty. - CheckForNoChangeOrThrow checker( this, &Thingy::IsValid, &Thingy::IsValidFull, &Thingy::IsValidFull ); + CheckFor::NoChangeOrThrow checker( this, &Thingy::IsValid, &Thingy::IsValidFull, &Thingy::IsValidFull ); if ( m_counts.size() <= index ) return 0; const unsigned int count = m_counts[ index ]; @@ -276,7 +271,7 @@ // but does not need to check pre-conditions, so it passes in a nullptr for // the pre-condition validator. Ths post-condition validator just makes sure // the container has no elements. - CheckForNoThrow checker( this, &Thingy::IsValid, nullptr, &Thingy::IsValidEmpty ); + CheckFor::NoThrow checker( this, &Thingy::IsValid, nullptr, &Thingy::IsValidEmpty ); m_counts.clear(); } @@ -328,16 +323,10 @@ // ---------------------------------------------------------------------------- -// These lines show how to declare checkers for standalone functions. -typedef ::Loki::StaticChecker< ::Loki::CheckStaticForNoThrow > CheckStaticForNoThrow; -typedef ::Loki::StaticChecker< ::Loki::CheckStaticForNothing > CheckStaticInvariants; - -// ---------------------------------------------------------------------------- - void DoSomething( void ) { // This example shows how to use a checker in a stand-alone function. - CheckStaticForNoThrow checker( &AllIsValid ); + ::Loki::CheckStaticFor::NoThrow checker( &AllIsValid ); (void)checker; Thingy::ChangeThat(); } @@ -355,6 +344,8 @@ int main( unsigned int argc, const char * const argv[] ) { + (void)argc; + (void)argv; try { cout << "Just before call to ThrowTest." << endl; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-10-10 23:43:10
|
Revision: 1032 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=1032&view=rev Author: rich_sposato Date: 2009-10-10 23:43:02 +0000 (Sat, 10 Oct 2009) Log Message: ----------- Added new configurations to differentiate between cygwin-gcc and gnu-gcc. Modified Paths: -------------- trunk/Loki.cbp trunk/test/Longevity/Longevity.cbp trunk/test/RegressionTest/RegressionTest.cbp Modified: trunk/Loki.cbp =================================================================== --- trunk/Loki.cbp 2009-10-10 23:11:31 UTC (rev 1031) +++ trunk/Loki.cbp 2009-10-10 23:43:02 UTC (rev 1032) @@ -5,11 +5,39 @@ <Option title="Loki" /> <Option compiler="cygwin" /> <Build> - <Target title="Debug"> - <Option output=".\lib\Loki_D" prefix_auto="0" extension_auto="1" /> + <Target title="Debug_GCC"> + <Option output=".\lib\GCC\Loki_D" prefix_auto="0" extension_auto="1" /> <Option working_dir="" /> - <Option object_output="obj\Debug\" /> + <Option object_output="obj\Debug_GCC\" /> <Option type="2" /> + <Option compiler="gcc" /> + <Option createDefFile="1" /> + <Compiler> + <Add option="-W" /> + <Add option="-g" /> + <Add directory="." /> + <Add directory=".\include" /> + <Add directory=".\include\loki" /> + </Compiler> + </Target> + <Target title="Release_GCC"> + <Option output=".\lib\GCC\Loki" prefix_auto="0" extension_auto="1" /> + <Option working_dir="" /> + <Option object_output="obj\Release_GCC\" /> + <Option type="2" /> + <Option compiler="gcc" /> + <Option createDefFile="1" /> + <Compiler> + <Add option="-W" /> + <Add directory=".\include\loki" /> + <Add directory=".\include" /> + </Compiler> + </Target> + <Target title="Debug_Cygwin"> + <Option output=".\lib\Cygwin\Loki_D.a" prefix_auto="0" extension_auto="0" /> + <Option working_dir="" /> + <Option object_output="obj\Debug_Cygwin\" /> + <Option type="2" /> <Option compiler="cygwin" /> <Option createDefFile="1" /> <Compiler> @@ -20,10 +48,10 @@ <Add directory=".\include\loki" /> </Compiler> </Target> - <Target title="Release"> - <Option output=".\lib\Loki" prefix_auto="0" extension_auto="1" /> + <Target title="Release_Cygwin"> + <Option output=".\lib\Cygwin\Loki.a" prefix_auto="0" extension_auto="0" /> <Option working_dir="" /> - <Option object_output="obj\Release\" /> + <Option object_output="obj\Release_Cygwin\" /> <Option type="2" /> <Option compiler="cygwin" /> <Option createDefFile="1" /> Modified: trunk/test/Longevity/Longevity.cbp =================================================================== --- trunk/test/Longevity/Longevity.cbp 2009-10-10 23:11:31 UTC (rev 1031) +++ trunk/test/Longevity/Longevity.cbp 2009-10-10 23:43:02 UTC (rev 1032) @@ -5,10 +5,42 @@ <Option title="Longevity" /> <Option compiler="cygwin" /> <Build> - <Target title="Debug"> - <Option output="obj\Debug\Longevity" prefix_auto="1" extension_auto="1" /> - <Option object_output="obj\Debug\" /> + <Target title="Debug_GCC"> + <Option output="obj\Debug_GCC\Longevity" prefix_auto="1" extension_auto="1" /> + <Option object_output="obj\Debug_GCC\" /> <Option type="1" /> + <Option compiler="gcc" /> + <Compiler> + <Add option="-W" /> + <Add option="-g" /> + <Add directory="..\..\include\loki" /> + <Add directory="..\..\include" /> + </Compiler> + <Linker> + <Add library="..\..\lib\GCC\Loki_D.a" /> + </Linker> + </Target> + <Target title="Release_GCC"> + <Option output="obj\Release_GCC\Longevity" prefix_auto="1" extension_auto="1" /> + <Option object_output="obj\Release_GCC\" /> + <Option type="1" /> + <Option compiler="gcc" /> + <Compiler> + <Add option="-fexpensive-optimizations" /> + <Add option="-Os" /> + <Add option="-O3" /> + <Add option="-W" /> + <Add directory="..\..\include\loki" /> + <Add directory="..\..\include" /> + </Compiler> + <Linker> + <Add library="..\..\lib\GCC\Loki.a" /> + </Linker> + </Target> + <Target title="Debug_Cygwin"> + <Option output="obj\Debug_Cygwin\Longevity" prefix_auto="1" extension_auto="1" /> + <Option object_output="obj\Debug_Cygwin\" /> + <Option type="1" /> <Option compiler="cygwin" /> <Compiler> <Add option="-W" /> @@ -17,12 +49,12 @@ <Add directory="..\..\include" /> </Compiler> <Linker> - <Add library="..\..\lib\Loki_D.a" /> + <Add library="..\..\lib\Cygwin\Loki_D.a" /> </Linker> </Target> - <Target title="Release"> - <Option output="obj\Release\Longevity" prefix_auto="1" extension_auto="1" /> - <Option object_output="obj\Release\" /> + <Target title="Release_Cygwin"> + <Option output="obj\Release_Cygwin\Longevity" prefix_auto="1" extension_auto="1" /> + <Option object_output="obj\Release_Cygwin\" /> <Option type="1" /> <Option compiler="cygwin" /> <Compiler> @@ -34,7 +66,7 @@ <Add directory="..\..\include" /> </Compiler> <Linker> - <Add library="..\..\lib\Loki.a" /> + <Add library="..\..\lib\Cygwin\Loki.a" /> </Linker> </Target> </Build> Modified: trunk/test/RegressionTest/RegressionTest.cbp =================================================================== --- trunk/test/RegressionTest/RegressionTest.cbp 2009-10-10 23:11:31 UTC (rev 1031) +++ trunk/test/RegressionTest/RegressionTest.cbp 2009-10-10 23:43:02 UTC (rev 1032) @@ -5,10 +5,36 @@ <Option title="RegressionTest" /> <Option compiler="cygwin" /> <Build> - <Target title="Debug"> - <Option output="bin\Debug\RegressionTest" prefix_auto="1" extension_auto="1" /> - <Option object_output="obj\Debug\" /> + <Target title="Debug_GCC"> + <Option output="bin\Debug_GCC\RegressionTest" prefix_auto="1" extension_auto="1" /> + <Option object_output="obj\Debug_GCC\" /> <Option type="1" /> + <Option compiler="gcc" /> + <Compiler> + <Add option="-W" /> + <Add option="-g" /> + <Add directory="..\..\include\loki" /> + <Add directory="..\..\include" /> + </Compiler> + </Target> + <Target title="Release_GCC"> + <Option output="bin\Release_GCC\RegressionTest" prefix_auto="1" extension_auto="1" /> + <Option object_output="obj\Release_GCC\" /> + <Option type="1" /> + <Option compiler="gcc" /> + <Compiler> + <Add option="-fexpensive-optimizations" /> + <Add option="-Os" /> + <Add option="-O3" /> + <Add option="-W" /> + <Add directory="..\..\include\loki" /> + <Add directory="..\..\include" /> + </Compiler> + </Target> + <Target title="Debug_Cygwin"> + <Option output="bin\Debug_Cygwin\RegressionTest" prefix_auto="1" extension_auto="1" /> + <Option object_output="obj\Debug_Cygwin\" /> + <Option type="1" /> <Option compiler="cygwin" /> <Compiler> <Add option="-W" /> @@ -17,9 +43,9 @@ <Add directory="..\..\include" /> </Compiler> </Target> - <Target title="Release"> - <Option output="bin\Release\RegressionTest" prefix_auto="1" extension_auto="1" /> - <Option object_output="obj\Release\" /> + <Target title="Release_Cygwin"> + <Option output="bin\Release_Cygwin\RegressionTest" prefix_auto="1" extension_auto="1" /> + <Option object_output="obj\Release_Cygwin\" /> <Option type="1" /> <Option compiler="cygwin" /> <Compiler> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-11-10 19:22:24
|
Revision: 1052 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=1052&view=rev Author: rich_sposato Date: 2009-11-10 19:22:16 +0000 (Tue, 10 Nov 2009) Log Message: ----------- Implemented patch 2893162 to allow dynamic-casting with SmartPtr and StrongPtr. Modified Paths: -------------- trunk/include/loki/SmartPtr.h trunk/include/loki/StrongPtr.h trunk/src/StrongPtr.cpp Modified: trunk/include/loki/SmartPtr.h =================================================================== --- trunk/include/loki/SmartPtr.h 2009-11-02 22:45:51 UTC (rev 1051) +++ trunk/include/loki/SmartPtr.h 2009-11-10 19:22:16 UTC (rev 1052) @@ -194,9 +194,9 @@ // Destroys the data stored // (Destruction might be taken over by the OwnershipPolicy) - // - // If your compiler gives you a warning in this area while - // compiling the tests, it is on purpose, please ignore it. + // + // If your compiler gives you a warning in this area while + // compiling the tests, it is on purpose, please ignore it. void Destroy() { delete pointee_; @@ -1172,6 +1172,45 @@ typedef typename Select<false, const StoredType&, NeverMatched>::Result ExplicitArg; #endif + /// SmartPtr uses this helper class to specify the dynamic-caster constructor. + class DynamicCastHelper {}; + + /// Private constructor is only used for dynamic-casting. + template + < + typename T1, + template < class > class OP1, + class CP1, + template < class > class KP1, + template < class > class SP1, + template < class > class CNP1 + > + SmartPtr( const SmartPtr< T1, OP1, CP1, KP1, SP1, CNP1 > & rhs, const DynamicCastHelper & helper ) + { + (void)helper; // do void cast to remove compiler warning. + // Dynamic casting from T1 to T and saving result in `this''s pointer + PointerType p = dynamic_cast< PointerType >( GetImplRef( rhs ) ); + GetImplRef( *this ) = OP::Clone( p ); + } + + /// Private constructor is only used for dynamic-casting. + template + < + typename T1, + template < class > class OP1, + class CP1, + template < class > class KP1, + template < class > class SP1, + template < class > class CNP1 + > + SmartPtr( SmartPtr< T1, OP1, CP1, KP1, SP1, CNP1 > & rhs, const DynamicCastHelper & helper ) + { + (void)helper; // do void cast to remove compiler warning. + // Dynamic casting from T1 to T and saving result in `this''s pointer + PointerType p = dynamic_cast< PointerType >( GetImplRef( rhs ) ); + GetImplRef( *this ) = OP::Clone( p ); + } + public: SmartPtr() @@ -1206,7 +1245,9 @@ > SmartPtr(const SmartPtr<T1, OP1, CP1, KP1, SP1, CNP1 >& rhs) : SP(rhs), OP(rhs), KP(rhs), CP(rhs) - { GetImplRef(*this) = OP::Clone(GetImplRef(rhs)); } + { + GetImplRef(*this) = OP::Clone(GetImplRef(rhs)); + } template < @@ -1285,6 +1326,40 @@ } } + /// Dynamically-casts parameter pointer to the type specified by this SmartPtr type. + template + < + typename T1, + template < class > class OP1, + class CP1, + template < class > class KP1, + template < class > class SP1, + template < class > class CNP1 + > + SmartPtr & DynamicCastFrom( const SmartPtr< T1, OP1, CP1, KP1, SP1, CNP1 > & rhs ) + { + SmartPtr temp( rhs, DynamicCastHelper() ); + temp.Swap( *this ); + return *this; + } + + /// Dynamically-casts parameter pointer to the type specified by this SmartPtr type. + template + < + typename T1, + template < class > class OP1, + class CP1, + template < class > class KP1, + template < class > class SP1, + template < class > class CNP1 + > + SmartPtr & DynamicCastFrom( SmartPtr< T1, OP1, CP1, KP1, SP1, CNP1 > & rhs ) + { + SmartPtr temp( rhs, DynamicCastHelper() ); + temp.Swap( *this ); + return *this; + } + #ifdef LOKI_ENABLE_FRIEND_TEMPLATE_TEMPLATE_PARAMETER_WORKAROUND // old non standard in class definition of friends Modified: trunk/include/loki/StrongPtr.h =================================================================== --- trunk/include/loki/StrongPtr.h 2009-11-02 22:45:51 UTC (rev 1051) +++ trunk/include/loki/StrongPtr.h 2009-11-10 19:22:16 UTC (rev 1052) @@ -564,6 +564,8 @@ Increment( strong ); } + TwoRefCounts( const TwoRefCounts & rhs, bool isNull, bool strong ); + /** The destructor does not need to do anything since the call to ZapPointer inside StrongPtr::~StrongPtr will do the cleanup which this dtor would have done. @@ -664,6 +666,24 @@ Increment( strong ); } + LockableTwoRefCounts( const LockableTwoRefCounts & rhs, bool isNull, bool strong ) : + m_counts( ( isNull ) ? NULL : rhs.m_counts ) + { + if ( isNull ) + { + void * temp = ThreadSafePointerAllocator::operator new( + sizeof(Loki::Private::LockableTwoRefCountInfo) ); +#ifdef DO_EXTRA_LOKI_TESTS + assert( temp != 0 ); +#endif + m_counts = new ( temp ) Loki::Private::LockableTwoRefCountInfo( strong ); + } + else + { + Increment( strong ); + } + } + /** The destructor does not need to do anything since the call to ZapPointer inside StrongPtr::~StrongPtr will do the cleanup which this dtor would have done. @@ -789,6 +809,8 @@ TwoRefLinks( const TwoRefLinks & rhs, bool strong ); + TwoRefLinks( const TwoRefLinks & rhs, bool isNull, bool strong ); + bool Release( bool strong ); void Swap( TwoRefLinks & rhs ); @@ -893,6 +915,49 @@ typedef typename Select<false, const StoredType&, NeverMatched>::Result ExplicitArg; #endif + /// StrongPtr uses this helper class to specify the dynamic-caster constructor. + class DynamicCastHelper {}; + + /// Private constructor is only used for dynamic-casting. + template + < + typename T1, + bool S1, + class OP1, + class CP1, + template < class > class KP1, + template < class > class RP1, + template < class > class DP1, + template < class > class CNP1 + > + StrongPtr( const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs, + bool isNull, const DynamicCastHelper & helper ) + // Dynamic casting from T1 to T and saving result in ownership policy. + : OP( rhs, isNull, Strong ) + { + (void)helper; // do void cast to remove compiler warning. + } + + /// Private constructor is only used for dynamic-casting. + template + < + typename T1, + bool S1, + class OP1, + class CP1, + template < class > class KP1, + template < class > class RP1, + template < class > class DP1, + template < class > class CNP1 + > + StrongPtr( StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs, + bool isNull, const DynamicCastHelper & helper ) + // Dynamic casting from T1 to T and saving result in ownership policy. + : OP( rhs, isNull, Strong ) + { + (void)helper; // do void cast to remove compiler warning. + } + public: StrongPtr( void ) : OP( Strong ) @@ -1032,6 +1097,56 @@ } } + /// Dynamically-casts parameter pointer to the type specified by this SmartPtr type. + template + < + typename T1, + bool S1, + class OP1, + class CP1, + template < class > class KP1, + template < class > class RP1, + template < class > class DP1, + template < class > class CNP1 + > + StrongPtr & DynamicCastFrom( const StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) + { + typedef typename StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 >::PointerType RightPointerType; + const StrongPtr & sp = reinterpret_cast< const StrongPtr & >( rhs ); + PointerType p = sp.GetPointer(); + const RightPointerType rp = reinterpret_cast< const RightPointerType >( p ); + p = dynamic_cast< const PointerType >( rp ); + const bool isNull = ( NULL == p ); + StrongPtr temp( rhs, isNull, DynamicCastHelper() ); + Swap( temp ); + return *this; + } + + /// Dynamically-casts parameter pointer to the type specified by this SmartPtr type. + template + < + typename T1, + bool S1, + class OP1, + class CP1, + template < class > class KP1, + template < class > class RP1, + template < class > class DP1, + template < class > class CNP1 + > + StrongPtr & DynamicCastFrom( StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 > & rhs ) + { + typedef typename StrongPtr< T1, S1, OP1, CP1, KP1, RP1, DP1, CNP1 >::PointerType RightPointerType; + StrongPtr & sp = reinterpret_cast< StrongPtr & >( rhs ); + PointerType p = sp.GetPointer(); + RightPointerType rp = reinterpret_cast< RightPointerType >( p ); + p = dynamic_cast< PointerType >( rp ); + const bool isNull = ( NULL == p ); + StrongPtr temp( rhs, isNull, DynamicCastHelper() ); + Swap( temp ); + return *this; + } + #ifdef LOKI_ENABLE_FRIEND_TEMPLATE_TEMPLATE_PARAMETER_WORKAROUND // old non standard in class definition of friends @@ -1663,35 +1778,4 @@ namespace std { //////////////////////////////////////////////////////////////////////////////// - /// specialization of std::less for StrongPtr - /// \ingroup SmartPointerGroup - //////////////////////////////////////////////////////////////////////////////// - template - < - typename T, - bool S, - class OP, - class CP, - template < class > class KP, - template < class > class RP, - template < class > class DP, - template < class > class CNP - > - struct less< Loki::StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > > - : public binary_function< - Loki::StrongPtr< T, S, OP, CP, KP, RP, DP, CNP >, - Loki::StrongPtr< T, S, OP, CP, KP, RP, DP, CNP >, bool > - { - bool operator () ( - const Loki::StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & lhs, - const Loki::StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > & rhs ) const - { - return ( lhs < rhs ); - } - }; -} - -//////////////////////////////////////////////////////////////////////////////// - -#endif // end file guardian - + /// specialization of std::less for StroeTracker@Private@Loki@@@std@@@std@@QBEXABV123@@Z |
From: <ric...@us...> - 2010-09-08 01:03:27
|
Revision: 1071 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=1071&view=rev Author: rich_sposato Date: 2010-09-08 01:03:21 +0000 (Wed, 08 Sep 2010) Log Message: ----------- Put some code within Loki::Private namespace. Modified Paths: -------------- trunk/include/loki/SmallObj.h trunk/src/SmallObj.cpp Modified: trunk/include/loki/SmallObj.h =================================================================== --- trunk/include/loki/SmallObj.h 2010-09-08 00:48:29 UTC (rev 1070) +++ trunk/include/loki/SmallObj.h 2010-09-08 01:03:21 UTC (rev 1071) @@ -75,7 +75,10 @@ } - class FixedAllocator; + namespace Private + { + class FixedAllocator; + }; // end namespace Private /** @class SmallObjAllocator @ingroup SmallObjectGroupInternal @@ -92,8 +95,8 @@ @param maxObjectSize Max # of bytes which this may allocate. @param objectAlignSize # of bytes between alignment boundaries. */ - SmallObjAllocator( std::size_t pageSize, std::size_t maxObjectSize, - std::size_t objectAlignSize ); + SmallObjAllocator( ::std::size_t pageSize, ::std::size_t maxObjectSize, + ::std::size_t objectAlignSize ); /** Destructor releases all blocks, all Chunks, and FixedAllocator's. Any outstanding blocks are unavailable, and should not be used after @@ -150,7 +153,7 @@ void Deallocate( void * p ); /// Returns max # of bytes which this can allocate. - inline std::size_t GetMaxObjectSize() const + inline ::std::size_t GetMaxObjectSize() const { return maxSmallObjectSize_; } /// Returns # of bytes between allocation boundaries. @@ -184,16 +187,15 @@ SmallObjAllocator & operator = ( const SmallObjAllocator & ); /// Pointer to array of fixed-size allocators. - Loki::FixedAllocator * pool_; + ::Loki::Private::FixedAllocator * pool_; /// Largest object size supported by allocators. - const std::size_t maxSmallObjectSize_; + const ::std::size_t maxSmallObjectSize_; /// Size of alignment boundaries. - const std::size_t objectAlignSize_; + const ::std::size_t objectAlignSize_; }; - /** @class AllocatorSingleton @ingroup SmallObjectGroupInternal This template class is derived from Modified: trunk/src/SmallObj.cpp =================================================================== --- trunk/src/SmallObj.cpp 2010-09-08 00:48:29 UTC (rev 1070) +++ trunk/src/SmallObj.cpp 2010-09-08 01:03:21 UTC (rev 1071) @@ -15,6 +15,7 @@ // $Id$ +// ---------------------------------------------------------------------------- #include <loki/SmallObj.h> @@ -32,13 +33,17 @@ #endif #if !defined( nullptr ) - #define nullptr + #define nullptr 0 #endif namespace Loki { +namespace Private +{ +// ---------------------------------------------------------------------------- + /** @struct Chunk @ingroup SmallObjectGroupInternal Contains info about each allocated Chunk - which is a collection of @@ -302,6 +307,26 @@ unsigned char FixedAllocator::MinObjectsPerChunk_ = 8; unsigned char FixedAllocator::MaxObjectsPerChunk_ = UCHAR_MAX; +/** @ingroup SmallObjectGroupInternal + Calls the default allocator when SmallObjAllocator decides not to handle a + request. SmallObjAllocator calls this if the number of bytes is bigger than + the size which can be handled by any FixedAllocator. + @param numBytes number of bytes + @param doThrow True if this function should throw an exception, or false if it + should indicate failure by returning a nullptr pointer. +*/ +void * DefaultAllocator( std::size_t numBytes, bool doThrow ); + +/** @ingroup SmallObjectGroupInternal + Calls default deallocator when SmallObjAllocator decides not to handle a + request. The default deallocator could be the global delete operator or the + free function. The free function is the preferred default deallocator since + it matches malloc which is the preferred default allocator. SmallObjAllocator + will call this if an address was not found among any of its own blocks. + */ +void DefaultDeallocator( void * p ); + + // Chunk::Init ---------------------------------------------------------------- bool Chunk::Init( std::size_t blockSize, unsigned char blocks ) @@ -1024,14 +1049,7 @@ } // DefaultAllocator ----------------------------------------------------------- -/** @ingroup SmallObjectGroupInternal - Calls the default allocator when SmallObjAllocator decides not to handle a - request. SmallObjAllocator calls this if the number of bytes is bigger than - the size which can be handled by any FixedAllocator. - @param numBytes number of bytes - @param doThrow True if this function should throw an exception, or false if it - should indicate failure by returning a nullptr pointer. -*/ + void * DefaultAllocator( std::size_t numBytes, bool doThrow ) { #ifdef USE_NEW_TO_ALLOCATE @@ -1046,13 +1064,7 @@ } // DefaultDeallocator --------------------------------------------------------- -/** @ingroup SmallObjectGroupInternal - Calls default deallocator when SmallObjAllocator decides not to handle a - request. The default deallocator could be the global delete operator or the - free function. The free function is the preferred default deallocator since - it matches malloc which is the preferred default allocator. SmallObjAllocator - will call this if an address was not found among any of its own blocks. - */ + void DefaultDeallocator( void * p ) { #ifdef USE_NEW_TO_ALLOCATE @@ -1062,6 +1074,13 @@ #endif } +// ---------------------------------------------------------------------------- + +}; // end namespace Private + +using namespace ::Loki::Private; + + // SmallObjAllocator::SmallObjAllocator --------------------------------------- SmallObjAllocator::SmallObjAllocator( std::size_t pageSize, @@ -1176,8 +1195,8 @@ { if ( nullptr == p ) return; assert( nullptr != pool_ ); - FixedAllocator * pAllocator = nullptr; - const std::size_t allocCount = GetOffset( GetMaxObjectSize(), GetAlignment() ); + ::Loki::Private::FixedAllocator * pAllocator = nullptr; + const std::size_t allocCount = ::Loki::Private::GetOffset( GetMaxObjectSize(), GetAlignment() ); Chunk * chunk = nullptr; for ( std::size_t ii = 0; ii < allocCount; ++ii ) @@ -1230,4 +1249,3 @@ } } // end namespace Loki - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2011-09-20 23:25:47
|
Revision: 1112 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=1112&view=rev Author: rich_sposato Date: 2011-09-20 23:25:41 +0000 (Tue, 20 Sep 2011) Log Message: ----------- -m Modified Paths: -------------- trunk/include/loki/StrongPtr.h trunk/src/StrongPtr.cpp Modified: trunk/include/loki/StrongPtr.h =================================================================== --- trunk/include/loki/StrongPtr.h 2011-09-20 23:19:14 UTC (rev 1111) +++ trunk/include/loki/StrongPtr.h 2011-09-20 23:25:41 UTC (rev 1112) @@ -85,7 +85,10 @@ /// If you write your own policy, you must implement these 3 functions: /// -# void static Delete( const P * p ) /// -# static P * Default( void ) -/// -# void Swap( YourResetPolicy & ) +/// -# Default constructor. +/// -# Copy constructor. +/// -# Templated copy constructor. +/// -# void Swap( YourDeletePolicy & ) /// /// \par ResetPolicy /// A reset policy tells the ReleaseAll and ResetAll functions whether they @@ -235,46 +238,7 @@ inline void Swap( DeleteSingle & ) {} }; -namespace Private -{ - //////////////////////////////////////////////////////////////////////////////// -/// \class DeleteArrayBase -/// -/// \ingroup StrongPointerDeleteGroup -/// Base class used only by the DeleteArray policy class. This stores the -/// number of elements in an array of shared objects. -//////////////////////////////////////////////////////////////////////////////// - -class DeleteArrayBase -{ -public: - - inline size_t GetArrayCount( void ) const { return m_itemCount; } - -protected: - - DeleteArrayBase( void ) : m_itemCount( 0 ) {} - - explicit DeleteArrayBase( size_t itemCount ) : m_itemCount( itemCount ) {} - - DeleteArrayBase( const DeleteArrayBase & that ) : m_itemCount( that.m_itemCount ) {} - - void Swap( DeleteArrayBase & rhs ); - - void OnInit( const void * p ) const; - - void OnCheckRange( size_t index ) const; - -private: - - size_t m_itemCount; - -}; - -} - -//////////////////////////////////////////////////////////////////////////////// /// \class DeleteArray /// /// \ingroup StrongPointerDeleteGroup @@ -2068,19 +2032,27 @@ return * GetPointer(); } + /** operator[] returns a reference to an modifiable object. If the index is greater than or + equal to the number of elements, the function will throw a std::out_of_range exception. + This only works with DeleteArray policy. Any other policy will cause a compiler error. + */ ReferenceType operator [] ( size_t index ) { - KP::OnDereference( GetPointer() ); - DP::OnCheckRange( index ); PointerType p = GetPointer(); + KP::OnDereference( p ); + DP::OnCheckRange( index ); return p[ index ]; } + /** operator[] returns a reference to a const object. If the index is greater than or + equal to the number of elements, the function will throw a std::out_of_range exception. + This only works with DeleteArray policy. Any other policy will cause a compiler error. + */ ConstReferenceType operator [] ( size_t index ) const { - KP::OnDereference( GetPointer() ); - DP::OnCheckRange( index ); ConstPointerType p = GetPointer(); + KP::OnDereference( p ); + DP::OnCheckRange( index ); return p[ index ]; } Modified: trunk/src/StrongPtr.cpp =================================================================== --- trunk/src/StrongPtr.cpp 2011-09-20 23:19:14 UTC (rev 1111) +++ trunk/src/StrongPtr.cpp 2011-09-20 23:25:41 UTC (rev 1112) @@ -15,9 +15,6 @@ #include <loki/StrongPtr.h> -#include <stdexcept> -#include <string> - #include <memory.h> #ifdef DO_EXTRA_LOKI_TESTS #include <cassert> @@ -41,45 +38,6 @@ // ---------------------------------------------------------------------------- -void DeleteArrayBase::Swap( DeleteArrayBase & rhs ) -{ - assert( NULL != this ); - - const size_t temp = m_itemCount; - m_itemCount = rhs.m_itemCount; - rhs.m_itemCount = temp; -} - -// ---------------------------------------------------------------------------- - -void DeleteArrayBase::OnInit( const void * p ) const -{ - assert( NULL != this ); - if ( NULL == p ) - { - assert( 0 == m_itemCount ); - } - else - { - assert( 0 < m_itemCount ); - } -} - -// ---------------------------------------------------------------------------- - -void DeleteArrayBase::OnCheckRange( size_t index ) const -{ - assert( NULL != this ); - - if ( index < m_itemCount ) - return; - - const ::std::string message( "index out of range in ::Loki::DeleteArrayBase::OnCheckRange" ); - throw ::std::out_of_range( message ); -} - -// ---------------------------------------------------------------------------- - OneOwnerRefCountInfo::OneOwnerRefCountInfo( SingleOwnerRefCount * ptr ) : m_pointer( NULL ) , m_strongPtr( ptr ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <syn...@us...> - 2011-09-29 19:56:45
|
Revision: 1117 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=1117&view=rev Author: syntheticpp Date: 2011-09-29 19:56:39 +0000 (Thu, 29 Sep 2011) Log Message: ----------- remove some GCC warnings and update Makefile Modified Paths: -------------- trunk/include/loki/LevelMutex.h trunk/include/loki/SmallObj.h trunk/include/loki/StrongPtr.h trunk/src/LevelMutex.cpp trunk/src/SmallObj.cpp trunk/src/StrongPtr.cpp trunk/test/SmartPtr/Makefile Modified: trunk/include/loki/LevelMutex.h =================================================================== --- trunk/include/loki/LevelMutex.h 2011-09-23 00:46:54 UTC (rev 1116) +++ trunk/include/loki/LevelMutex.h 2011-09-29 19:56:39 UTC (rev 1117) @@ -254,7 +254,7 @@ /** Returns true if this mutex was locked within the last count mutexes. @param count How many recent mutexes to look through to find this mutex. */ - bool IsRecentLock( unsigned int count ) const volatile; + bool IsRecentLock( std::size_t count ) const volatile; /// Returns true if this was locked by current thread. bool IsLockedByCurrentThread( void ) const volatile; Modified: trunk/include/loki/SmallObj.h =================================================================== --- trunk/include/loki/SmallObj.h 2011-09-23 00:46:54 UTC (rev 1116) +++ trunk/include/loki/SmallObj.h 2011-09-29 19:56:39 UTC (rev 1117) @@ -88,7 +88,7 @@ namespace Private { class FixedAllocator; - }; // end namespace Private + } // end namespace Private /** @class SmallObjAllocator @ingroup SmallObjectGroupInternal Modified: trunk/include/loki/StrongPtr.h =================================================================== --- trunk/include/loki/StrongPtr.h 2011-09-23 00:46:54 UTC (rev 1116) +++ trunk/include/loki/StrongPtr.h 2011-09-29 19:56:39 UTC (rev 1117) @@ -1468,9 +1468,9 @@ inline explicit TwoRefLinks( bool strong ) : m_pointer( 0 ) - , m_strong( strong ) , m_prev( this ) , m_next( this ) + , m_strong( strong ) { } Modified: trunk/src/LevelMutex.cpp =================================================================== --- trunk/src/LevelMutex.cpp 2011-09-23 00:46:54 UTC (rev 1116) +++ trunk/src/LevelMutex.cpp 2011-09-29 19:56:39 UTC (rev 1117) @@ -200,7 +200,7 @@ MutexErrors::Type DoMutexesMatchContainer( const LevelMutexInfo::MutexContainer & mutexes ) { - const unsigned int count = mutexes.size(); + const std::size_t count = mutexes.size(); if ( 0 == count ) return MutexErrors::EmptyContainer; unsigned int currentLevel = GetCurrentThreadsLevel(); @@ -334,7 +334,7 @@ { assert( IsValidList() ); - const unsigned int count = mutexes.size(); + const std::size_t count = mutexes.size(); if ( count == 0 ) return MutexErrors::EmptyContainer; @@ -417,7 +417,8 @@ if ( 0 == milliSeconds ) return MultiLock( mutexes ); - const unsigned int count = mutexes.size(); + + const std::size_t count = mutexes.size(); if ( 0 == count ) return MutexErrors::EmptyContainer; @@ -507,7 +508,7 @@ LevelMutexInfo::UnlockedLevel, result ); } - const unsigned int count = mutexes.size(); + const std::size_t count = mutexes.size(); if ( 1 < count ) { ::std::sort( mutexes.begin(), mutexes.end() ); @@ -628,7 +629,7 @@ // ---------------------------------------------------------------------------- -bool LevelMutexInfo::IsRecentLock( unsigned int count ) const volatile +bool LevelMutexInfo::IsRecentLock( std::size_t count ) const volatile { LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) Modified: trunk/src/SmallObj.cpp =================================================================== --- trunk/src/SmallObj.cpp 2011-09-23 00:46:54 UTC (rev 1116) +++ trunk/src/SmallObj.cpp 2011-09-29 19:56:39 UTC (rev 1117) @@ -1119,7 +1119,7 @@ // ---------------------------------------------------------------------------- -}; // end namespace Private +} // end namespace Private using namespace ::Loki::Private; Modified: trunk/src/StrongPtr.cpp =================================================================== --- trunk/src/StrongPtr.cpp 2011-09-23 00:46:54 UTC (rev 1116) +++ trunk/src/StrongPtr.cpp 2011-09-29 19:56:39 UTC (rev 1117) @@ -344,9 +344,9 @@ TwoRefLinks::TwoRefLinks( const void * p, bool strong ) : m_pointer( const_cast< void * >( p ) ) - , m_strong( strong ) , m_prev( this ) , m_next( this ) + , m_strong( strong ) { assert( IsValid() ); } Modified: trunk/test/SmartPtr/Makefile =================================================================== --- trunk/test/SmartPtr/Makefile 2011-09-23 00:46:54 UTC (rev 1116) +++ trunk/test/SmartPtr/Makefile 2011-09-29 19:56:39 UTC (rev 1117) @@ -1,7 +1,7 @@ include ../Makefile.common BIN := main$(BIN_SUFFIX) -SRC := main.cpp strong.cpp LockTest.cpp +SRC := main.cpp strong.cpp LockTest.cpp colvin_gibbons_trick.cpp OBJ := $(SRC:.cpp=.o) LDLIBS += -lpthread This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2011-10-22 00:20:15
|
Revision: 1162 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=1162&view=rev Author: rich_sposato Date: 2011-10-22 00:20:09 +0000 (Sat, 22 Oct 2011) Log Message: ----------- Replaced local Checker with Loki::CheckFor. Modified Paths: -------------- trunk/include/loki/LevelMutex.h trunk/src/LevelMutex.cpp Modified: trunk/include/loki/LevelMutex.h =================================================================== --- trunk/include/loki/LevelMutex.h 2011-10-21 23:10:53 UTC (rev 1161) +++ trunk/include/loki/LevelMutex.h 2011-10-22 00:20:09 UTC (rev 1162) @@ -51,6 +51,7 @@ #endif #include <loki/ThreadLocal.h> // Include Loki's form of thread_local declaration. +#include <loki/Checker.h> // Needed to check class invariants. #if !defined( LOKI_THREAD_LOCAL ) #warning "Your compiler will not allow Loki::LevelMutex." @@ -264,26 +265,12 @@ protected: - /** @class Checker Performs validity check on mutex to insure no class invariants - were violated inside any member function. This class only gets used in debug - builds, and any instance of it gets optimized away in release builds. A checker - is created inside many of member functions so that it's destructor gets called - when the function exits. It determines if any class invariants were violated - during the function call. + /** @note CheckFor performs validity checking in many functions to determine if the + code violated any invariants, if any content changed, or if the function threw an + exception. The checkers only get used in debug builds, and get optimized away in + release builds. */ - class Checker - { - public: - inline explicit Checker( const volatile LevelMutexInfo * mutex ) : - m_mutex( mutex ) { Check(); } - inline ~Checker( void ) { Check(); } - inline bool Check( void ) const { return m_mutex->IsValid(); } - private: - Checker( void ); - Checker( const Checker & ); - Checker & operator = ( const Checker & ); - const volatile LevelMutexInfo * m_mutex; - }; + typedef ::Loki::CheckFor< LevelMutexInfo > CheckFor; /** @class MutexUndoer Undoes actions by MultiLock if an exception occurs. It keeps track of @@ -778,7 +765,7 @@ virtual MutexErrors::Type TryLock( void ) volatile { - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) + LOKI_MUTEX_DEBUG_CODE( CheckFor::Invariants checker( this, &IsValid() ); (void)checker; ) MutexErrors::Type result = LevelMutexInfo::PreLockCheck( true ); if ( MutexErrors::Success == result ) @@ -799,7 +786,7 @@ virtual MutexErrors::Type Lock( void ) volatile { - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) + LOKI_MUTEX_DEBUG_CODE( CheckFor::Invariants checker( this, &IsValid() ); (void)checker; ) MutexErrors::Type result = LevelMutexInfo::PreLockCheck( false ); if ( MutexErrors::Success == result ) @@ -818,7 +805,7 @@ virtual MutexErrors::Type Lock( unsigned int milliSeconds ) volatile { - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) + LOKI_MUTEX_DEBUG_CODE( CheckFor::Invariants checker( this, &IsValid() ); (void)checker; ) MutexErrors::Type result = LevelMutexInfo::PreLockCheck( false ); if ( MutexErrors::Success == result ) @@ -853,7 +840,7 @@ virtual MutexErrors::Type Unlock( void ) volatile { - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) + LOKI_MUTEX_DEBUG_CODE( CheckFor::Invariants checker( this, &IsValid() ); (void)checker; ) MutexErrors::Type result = LevelMutexInfo::PreUnlockCheck(); if ( MutexErrors::Success == result ) @@ -898,7 +885,7 @@ */ virtual MutexErrors::Type LockThis( void ) volatile { - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) + LOKI_MUTEX_DEBUG_CODE( CheckFor::Invariants checker( this, &IsValid() ); (void)checker; ) assert( this != LevelMutexInfo::GetCurrentMutex() ); const MutexErrors::Type result = m_mutex.Lock(); @@ -918,7 +905,7 @@ */ virtual MutexErrors::Type LockThis( unsigned int milliSeconds ) volatile { - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) + LOKI_MUTEX_DEBUG_CODE( CheckFor::Invariants checker( this, &IsValid() ); (void)checker; ) clock_t timeOut = clock() + milliSeconds; while ( clock() < timeOut ) @@ -943,7 +930,7 @@ */ virtual MutexErrors::Type UnlockThis( void ) volatile { - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) + LOKI_MUTEX_DEBUG_CODE( CheckFor::Invariants checker( this, &IsValid() ); (void)checker; ) assert( NULL != LevelMutexInfo::GetCurrentMutex() ); if ( 1 < LevelMutexInfo::GetLockCount() ) Modified: trunk/src/LevelMutex.cpp =================================================================== --- trunk/src/LevelMutex.cpp 2011-10-21 23:10:53 UTC (rev 1161) +++ trunk/src/LevelMutex.cpp 2011-10-22 00:20:09 UTC (rev 1162) @@ -417,7 +417,7 @@ if ( 0 == milliSeconds ) return MultiLock( mutexes ); - + const std::size_t count = mutexes.size(); if ( 0 == count ) return MutexErrors::EmptyContainer; @@ -592,7 +592,7 @@ bool LevelMutexInfo::IsLockedByCurrentThread( void ) const volatile { - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) + LOKI_MUTEX_DEBUG_CODE( CheckFor::NoChangeOrThrow checker( this, &IsValid() ); (void)checker; ) if ( !IsLocked() ) return false; @@ -610,7 +610,7 @@ bool LevelMutexInfo::IsRecentLock( void ) const volatile { - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) + LOKI_MUTEX_DEBUG_CODE( CheckFor::NoChangeOrThrow checker( this, &IsValid() ); (void)checker; ) if ( 0 == m_count ) return false; @@ -631,7 +631,7 @@ bool LevelMutexInfo::IsRecentLock( std::size_t count ) const volatile { - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) + LOKI_MUTEX_DEBUG_CODE( CheckFor::NoChangeOrThrow checker( this, &IsValid() ); (void)checker; ) if ( 0 == count ) return false; @@ -651,7 +651,7 @@ bool LevelMutexInfo::IsLockedByAnotherThread( void ) const volatile { - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) + LOKI_MUTEX_DEBUG_CODE( CheckFor::NoChangeOrThrow checker( this, &IsValid() ); (void)checker; ) if ( !IsLocked() ) return false; @@ -666,7 +666,7 @@ void LevelMutexInfo::PostLock( void ) volatile { - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) + LOKI_MUTEX_DEBUG_CODE( CheckFor::NoThrow checker( this, &IsValid() ); (void)checker; ) assert( 0 == m_count ); assert( nullptr == m_previous ); assert( this != s_currentMutex ); @@ -681,7 +681,7 @@ void LevelMutexInfo::PreUnlock( void ) volatile { - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) + LOKI_MUTEX_DEBUG_CODE( CheckFor::NoThrow checker( this, &IsValid() ); (void)checker; ) assert( 1 == m_count ); assert( nullptr != s_currentMutex ); assert( this == s_currentMutex ); @@ -696,7 +696,7 @@ MutexErrors::Type LevelMutexInfo::PreLockCheck( bool forTryLock ) volatile { - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) + LOKI_MUTEX_DEBUG_CODE( CheckFor::NoThrow checker( this, &IsValid() ); (void)checker; ) const unsigned int currentLevel = GetCurrentThreadsLevel(); if ( currentLevel < LevelMutexInfo::GetLevel() ) @@ -730,7 +730,7 @@ MutexErrors::Type LevelMutexInfo::PreUnlockCheck( void ) volatile { - LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) + LOKI_MUTEX_DEBUG_CODE( CheckFor::NoThrow checker( this, &IsValid() ); (void)checker; ) if ( 0 == m_count ) return MutexErrors::WasntLocked; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2012-04-02 06:01:57
|
Revision: 1179 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=1179&view=rev Author: rich_sposato Date: 2012-04-02 06:01:51 +0000 (Mon, 02 Apr 2012) Log Message: ----------- Fixed bug 3509427 by adding use of Loki::TypeTraits. Modified Paths: -------------- trunk/include/loki/SafeFormat.h trunk/src/SafeFormat.cpp Modified: trunk/include/loki/SafeFormat.h =================================================================== --- trunk/include/loki/SafeFormat.h 2012-04-02 05:49:21 UTC (rev 1178) +++ trunk/include/loki/SafeFormat.h 2012-04-02 06:01:51 UTC (rev 1179) @@ -44,6 +44,7 @@ #include <iostream> #include <loki/LokiExport.h> +#include <loki/TypeTraits.h> // long is 32 bit on 64-bit Windows! @@ -132,7 +133,7 @@ another device type. It is not for public use. */ template < class Device2 > - PrintfState< Device2, Char > ChangeDevice( Device2 & device ) const + PrintfState< Device2, Char > ChangeDevice( typename Loki::TypeTraits< Device2 >::ParameterType device ) const { return PrintfState< Device2, Char >( device, format_, width_, prec_, flags_, result_ ); } Modified: trunk/src/SafeFormat.cpp =================================================================== --- trunk/src/SafeFormat.cpp 2012-04-02 05:49:21 UTC (rev 1178) +++ trunk/src/SafeFormat.cpp 2012-04-02 06:01:51 UTC (rev 1179) @@ -70,7 +70,7 @@ const PrintfState< ::std::string &, char > state1( buffer, format ); ::std::fwrite( buffer.c_str(), 1, buffer.size(), stdout ); ::std::FILE * f = stdout; - PrintfState< std::FILE *, char > printState2( state1.ChangeDevice( f ) ); + PrintfState< std::FILE *, char > printState2( state1.ChangeDevice< ::std::FILE * >( f ) ); return printState2; } @@ -79,7 +79,7 @@ const PrintfState< ::std::string &, char > state1( buffer, format.c_str() ); ::std::fwrite( buffer.c_str(), 1, buffer.size(), stdout ); ::std::FILE * f = stdout; - PrintfState< std::FILE *, char > printState2( state1.ChangeDevice( f ) ); + PrintfState< std::FILE *, char > printState2( state1.ChangeDevice< ::std::FILE * >( f ) ); return printState2; } @@ -87,7 +87,7 @@ ::std::string buffer; const PrintfState< ::std::string &, char > state1( buffer, format ); ::std::fwrite( buffer.c_str(), 1, buffer.size(), f ); - PrintfState< std::FILE *, char > printState2 = state1.ChangeDevice( f ); + PrintfState< std::FILE *, char > printState2 = state1.ChangeDevice< ::std::FILE * >( f ); return printState2; } @@ -95,7 +95,7 @@ ::std::string buffer; const PrintfState< ::std::string &, char > state1( buffer, format.c_str() ); ::std::fwrite( buffer.c_str(), 1, buffer.size(), f ); - PrintfState< std::FILE *, char > printState2 = state1.ChangeDevice( f ); + PrintfState< std::FILE *, char > printState2 = state1.ChangeDevice< ::std::FILE * >( f ); return printState2; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2013-06-19 02:23:07
|
Revision: 1184 http://sourceforge.net/p/loki-lib/code/1184 Author: rich_sposato Date: 2013-06-19 02:23:00 +0000 (Wed, 19 Jun 2013) Log Message: ----------- Added SmartAssert to Loki. Modified Paths: -------------- trunk/Loki.cbp trunk/Loki.sln trunk/Loki.workspace trunk/include/loki/ScopeGuard.h Added Paths: ----------- trunk/include/loki/Concatenate.h trunk/include/loki/SmartAssert.hpp trunk/src/SmartAssert.cpp trunk/test/SmartAssert/ trunk/test/SmartAssert/SmartAssert.cbp trunk/test/SmartAssert/SmartAssert.vcxproj trunk/test/SmartAssert/main.cpp Modified: trunk/Loki.cbp =================================================================== --- trunk/Loki.cbp 2012-04-03 05:46:56 UTC (rev 1183) +++ trunk/Loki.cbp 2013-06-19 02:23:00 UTC (rev 1184) @@ -6,9 +6,9 @@ <Option compiler="cygwin" /> <Build> <Target title="Debug_GCC"> - <Option output="./lib/GCC/Loki_D.a" prefix_auto="0" extension_auto="0" /> + <Option output=".\lib\GCC\Loki_D.a" prefix_auto="0" extension_auto="0" /> <Option working_dir="" /> - <Option object_output="obj/Debug_GCC/" /> + <Option object_output="obj\Debug_GCC\" /> <Option type="2" /> <Option compiler="gcc" /> <Option createDefFile="1" /> @@ -17,27 +17,27 @@ <Add option="-W" /> <Add option="-DDEBUG" /> <Add directory="." /> - <Add directory="./include" /> - <Add directory="./include/loki" /> + <Add directory=".\include" /> + <Add directory=".\include\loki" /> </Compiler> </Target> <Target title="Release_GCC"> - <Option output="./lib/GCC/Loki.a" prefix_auto="0" extension_auto="0" /> + <Option output=".\lib\GCC\Loki.a" prefix_auto="0" extension_auto="0" /> <Option working_dir="" /> - <Option object_output="obj/Release_GCC/" /> + <Option object_output="obj\Release_GCC\" /> <Option type="2" /> <Option compiler="gcc" /> <Option createDefFile="1" /> <Compiler> <Add option="-W" /> - <Add directory="./include/loki" /> - <Add directory="./include" /> + <Add directory=".\include\loki" /> + <Add directory=".\include" /> </Compiler> </Target> <Target title="Debug_Cygwin"> - <Option output="./lib/Cygwin/Loki_D.a" prefix_auto="0" extension_auto="0" /> + <Option output=".\lib\Cygwin\Loki_D.a" prefix_auto="0" extension_auto="0" /> <Option working_dir="" /> - <Option object_output="obj/Debug_Cygwin/" /> + <Option object_output="obj\Debug_Cygwin\" /> <Option type="2" /> <Option compiler="cygwin" /> <Option createDefFile="1" /> @@ -45,88 +45,90 @@ <Add option="-W" /> <Add option="-g" /> <Add directory="." /> - <Add directory="./include" /> - <Add directory="./include/loki" /> + <Add directory=".\include" /> + <Add directory=".\include\loki" /> </Compiler> </Target> <Target title="Release_Cygwin"> - <Option output="./lib/Cygwin/Loki.a" prefix_auto="0" extension_auto="0" /> + <Option output=".\lib\Cygwin\Loki.a" prefix_auto="0" extension_auto="0" /> <Option working_dir="" /> - <Option object_output="obj/Release_Cygwin/" /> + <Option object_output="obj\Release_Cygwin\" /> <Option type="2" /> <Option compiler="cygwin" /> <Option createDefFile="1" /> <Compiler> <Add option="-W" /> - <Add directory="./include/loki" /> - <Add directory="./include" /> + <Add directory=".\include\loki" /> + <Add directory=".\include" /> </Compiler> </Target> </Build> - <Unit filename="include/loki/AbstractFactory.h" /> - <Unit filename="include/loki/Allocator.h" /> - <Unit filename="include/loki/AssocVector.h" /> - <Unit filename="include/loki/CachedFactory.h" /> - <Unit filename="include/loki/CheckReturn.h" /> - <Unit filename="include/loki/Checker.h" /> - <Unit filename="include/loki/ConstPolicy.h" /> - <Unit filename="include/loki/DataGenerators.h" /> - <Unit filename="include/loki/EmptyType.h" /> - <Unit filename="include/loki/Factory.h" /> - <Unit filename="include/loki/Function.h" /> - <Unit filename="include/loki/Functor.h" /> - <Unit filename="include/loki/HierarchyGenerators.h" /> - <Unit filename="include/loki/Key.h" /> - <Unit filename="include/loki/LevelMutex.h" /> - <Unit filename="include/loki/LockingPtr.h" /> - <Unit filename="include/loki/LokiExport.h" /> - <Unit filename="include/loki/LokiTypeInfo.h" /> - <Unit filename="include/loki/MultiMethods.h" /> - <Unit filename="include/loki/NullType.h" /> - <Unit filename="include/loki/OrderedStatic.h" /> - <Unit filename="include/loki/Pimpl.h" /> - <Unit filename="include/loki/RefToValue.h" /> - <Unit filename="include/loki/Register.h" /> - <Unit filename="include/loki/SPCachedFactory.h" /> - <Unit filename="include/loki/SafeBits.h" /> - <Unit filename="include/loki/SafeFormat.h" /> - <Unit filename="include/loki/ScopeGuard.h" /> - <Unit filename="include/loki/Sequence.h" /> - <Unit filename="include/loki/Singleton.h" /> - <Unit filename="include/loki/SmallObj.h" /> - <Unit filename="include/loki/SmartPtr.h" /> - <Unit filename="include/loki/StrongPtr.h" /> - <Unit filename="include/loki/ThreadLocal.h" /> - <Unit filename="include/loki/Threads.h" /> - <Unit filename="include/loki/Tuple.h" /> - <Unit filename="include/loki/TypeManip.h" /> - <Unit filename="include/loki/TypeTraits.h" /> - <Unit filename="include/loki/Typelist.h" /> - <Unit filename="include/loki/TypelistMacros.h" /> - <Unit filename="include/loki/Visitor.h" /> - <Unit filename="include/loki/flex/allocatorstringstorage.h" /> - <Unit filename="include/loki/flex/cowstringopt.h" /> - <Unit filename="include/loki/flex/flex_string.h" /> - <Unit filename="include/loki/flex/flex_string_details.h" /> - <Unit filename="include/loki/flex/flex_string_shell.h" /> - <Unit filename="include/loki/flex/simplestringstorage.h" /> - <Unit filename="include/loki/flex/smallstringopt.h" /> - <Unit filename="include/loki/flex/vectorstringstorage.h" /> - <Unit filename="include/loki/static_check.h" /> - <Unit filename="include/loki/yasli/platform.h" /> - <Unit filename="include/loki/yasli/random.h" /> - <Unit filename="include/loki/yasli/yasli_fill_iterator.h" /> - <Unit filename="include/loki/yasli/yasli_memory.h" /> - <Unit filename="include/loki/yasli/yasli_protocols.h" /> - <Unit filename="include/loki/yasli/yasli_traits.h" /> - <Unit filename="include/loki/yasli/yasli_vector.h" /> - <Unit filename="src/LevelMutex.cpp" /> - <Unit filename="src/OrderedStatic.cpp" /> - <Unit filename="src/SafeFormat.cpp" /> - <Unit filename="src/Singleton.cpp" /> - <Unit filename="src/SmallObj.cpp" /> - <Unit filename="src/SmartPtr.cpp" /> - <Unit filename="src/StrongPtr.cpp" /> + <Unit filename="include\loki\AbstractFactory.h" /> + <Unit filename="include\loki\Allocator.h" /> + <Unit filename="include\loki\AssocVector.h" /> + <Unit filename="include\loki\CachedFactory.h" /> + <Unit filename="include\loki\CheckReturn.h" /> + <Unit filename="include\loki\Checker.h" /> + <Unit filename="include\loki\ConstPolicy.h" /> + <Unit filename="include\loki\DataGenerators.h" /> + <Unit filename="include\loki\EmptyType.h" /> + <Unit filename="include\loki\Factory.h" /> + <Unit filename="include\loki\Function.h" /> + <Unit filename="include\loki\Functor.h" /> + <Unit filename="include\loki\HierarchyGenerators.h" /> + <Unit filename="include\loki\Key.h" /> + <Unit filename="include\loki\LevelMutex.h" /> + <Unit filename="include\loki\LockingPtr.h" /> + <Unit filename="include\loki\LokiExport.h" /> + <Unit filename="include\loki\LokiTypeInfo.h" /> + <Unit filename="include\loki\MultiMethods.h" /> + <Unit filename="include\loki\NullType.h" /> + <Unit filename="include\loki\OrderedStatic.h" /> + <Unit filename="include\loki\Pimpl.h" /> + <Unit filename="include\loki\RefToValue.h" /> + <Unit filename="include\loki\Register.h" /> + <Unit filename="include\loki\SPCachedFactory.h" /> + <Unit filename="include\loki\SafeBits.h" /> + <Unit filename="include\loki\SafeFormat.h" /> + <Unit filename="include\loki\ScopeGuard.h" /> + <Unit filename="include\loki\Sequence.h" /> + <Unit filename="include\loki\Singleton.h" /> + <Unit filename="include\loki\SmallObj.h" /> + <Unit filename="include\loki\SmartAssert.hpp" /> + <Unit filename="include\loki\SmartPtr.h" /> + <Unit filename="include\loki\StrongPtr.h" /> + <Unit filename="include\loki\ThreadLocal.h" /> + <Unit filename="include\loki\Threads.h" /> + <Unit filename="include\loki\Tuple.h" /> + <Unit filename="include\loki\TypeManip.h" /> + <Unit filename="include\loki\TypeTraits.h" /> + <Unit filename="include\loki\Typelist.h" /> + <Unit filename="include\loki\TypelistMacros.h" /> + <Unit filename="include\loki\Visitor.h" /> + <Unit filename="include\loki\flex\allocatorstringstorage.h" /> + <Unit filename="include\loki\flex\cowstringopt.h" /> + <Unit filename="include\loki\flex\flex_string.h" /> + <Unit filename="include\loki\flex\flex_string_details.h" /> + <Unit filename="include\loki\flex\flex_string_shell.h" /> + <Unit filename="include\loki\flex\simplestringstorage.h" /> + <Unit filename="include\loki\flex\smallstringopt.h" /> + <Unit filename="include\loki\flex\vectorstringstorage.h" /> + <Unit filename="include\loki\static_check.h" /> + <Unit filename="include\loki\yasli\platform.h" /> + <Unit filename="include\loki\yasli\random.h" /> + <Unit filename="include\loki\yasli\yasli_fill_iterator.h" /> + <Unit filename="include\loki\yasli\yasli_memory.h" /> + <Unit filename="include\loki\yasli\yasli_protocols.h" /> + <Unit filename="include\loki\yasli\yasli_traits.h" /> + <Unit filename="include\loki\yasli\yasli_vector.h" /> + <Unit filename="src\LevelMutex.cpp" /> + <Unit filename="src\OrderedStatic.cpp" /> + <Unit filename="src\SafeFormat.cpp" /> + <Unit filename="src\Singleton.cpp" /> + <Unit filename="src\SmallObj.cpp" /> + <Unit filename="src\SmartAssert.cpp" /> + <Unit filename="src\SmartPtr.cpp" /> + <Unit filename="src\StrongPtr.cpp" /> <Extensions> <code_completion /> <envvars /> Modified: trunk/Loki.sln =================================================================== --- trunk/Loki.sln 2012-04-03 05:46:56 UTC (rev 1183) +++ trunk/Loki.sln 2013-06-19 02:23:00 UTC (rev 1184) @@ -1,7 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 11.00 # Visual C++ Express 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Loki", "src\library.vcxproj", "{CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Factory", "test\Factory\Factory.vcxproj", "{925D5863-2F77-41B7-96F1-CC814762C40F}" ProjectSection(ProjectDependencies) = postProject {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} @@ -23,6 +21,9 @@ EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ScopeGuard", "test\ScopeGuard\ScopeGuard.vcxproj", "{D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Singleton", "test\Singleton\Singleton.vcxproj", "{9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}" ProjectSection(ProjectDependencies) = postProject @@ -30,8 +31,14 @@ EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Visitor", "test\Visitor\Visitor.vcxproj", "{0A696379-10A2-43FB-A26C-B42456FCF657}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flex_string", "test\flex_string\flex_string.vcxproj", "{2022B9AD-34CA-4FDA-80C2-42805FABE65B}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmallObjCompare", "test\SmallObj\SmallObjCompare.vcxproj", "{0A98B714-818C-4DD3-A07C-BDD16399F362}" ProjectSection(ProjectDependencies) = postProject @@ -44,8 +51,14 @@ EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DeletableSingleton", "test\DeletableSingleton\DeletableSingleton.vcxproj", "{B87B3522-7DAA-400D-A47D-A74B9B8B3552}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DefaultAlloc", "test\SmallObj\DefaultAlloc.vcxproj", "{D490B134-B794-42CF-8AF8-9FDA524B9D3B}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmartPtr", "test\SmartPtr\SmartPtr.vcxproj", "{D7AB4FEF-E7AF-443D-93A5-37F323F2042D}" ProjectSection(ProjectDependencies) = postProject @@ -58,6 +71,9 @@ EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Pimpl", "test\Pimpl\Pimpl.vcxproj", "{21D2B291-80F4-476C-A643-B8A7034DF95F}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LockingPtr", "test\LockingPtr\LockingPtr.vcxproj", "{25766C3F-C0D8-429F-A212-5FA3537B3E1C}" ProjectSection(ProjectDependencies) = postProject @@ -65,10 +81,19 @@ EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Function", "test\Function\Function.vcxproj", "{2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CachedFactory", "test\CachedFactory\CachedFactory.vcxproj", "{8D186AB4-E544-42D6-B192-1AE2C946875E}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CheckReturn", "test\CheckReturn\CheckReturn.vcxproj", "{C0826A05-9143-4545-B5DE-811C188CB54E}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Checker", "test\Checker\Checker.vcxproj", "{B1C04D81-E666-466A-A394-A3E74C830692}" ProjectSection(ProjectDependencies) = postProject @@ -81,8 +106,14 @@ EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SafeBits", "test\SafeBits\SafeBits.vcxproj", "{ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AssocVector", "test\AssocVector\AssocVector.vcxproj", "{0605A820-D075-48AC-ABB6-D3FF05D5CD1F}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ThreadLocal", "test\ThreadLocal\ThreadLocal.vcxproj", "{27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}" EndProject @@ -91,23 +122,24 @@ {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AtomicThread", "test\AtomicThread\AtomicThread.vcxproj", "{BF3C905E-512C-4E64-B737-A6C5B3A18C7E}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Register", "test\Register\Register.vcxproj", "{873CFBF9-0D03-42D5-B2F9-A4C95A15EBCD}" ProjectSection(ProjectDependencies) = postProject {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "library", "src\Library.vcxproj", "{CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmartAssert", "test\SmartAssert\SmartAssert.vcxproj", "{DA7BBAE5-1C1A-4B5E-ABF1-2B5090DB2988}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Debug|Win32.ActiveCfg = Debug|Win32 - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Debug|Win32.Build.0 = Debug|Win32 - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release|Win32.ActiveCfg = Release|Win32 - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release|Win32.Build.0 = Release|Win32 {925D5863-2F77-41B7-96F1-CC814762C40F}.Debug|Win32.ActiveCfg = Debug|Win32 {925D5863-2F77-41B7-96F1-CC814762C40F}.Debug|Win32.Build.0 = Debug|Win32 {925D5863-2F77-41B7-96F1-CC814762C40F}.Release|Win32.ActiveCfg = Release|Win32 @@ -208,14 +240,18 @@ {22A34627-1480-4180-A8B6-4C05E77E27F8}.Debug|Win32.Build.0 = Debug|Win32 {22A34627-1480-4180-A8B6-4C05E77E27F8}.Release|Win32.ActiveCfg = Release|Win32 {22A34627-1480-4180-A8B6-4C05E77E27F8}.Release|Win32.Build.0 = Release|Win32 - {BF3C905E-512C-4E64-B737-A6C5B3A18C7E}.Debug|Win32.ActiveCfg = Debug|Win32 - {BF3C905E-512C-4E64-B737-A6C5B3A18C7E}.Debug|Win32.Build.0 = Debug|Win32 - {BF3C905E-512C-4E64-B737-A6C5B3A18C7E}.Release|Win32.ActiveCfg = Release|Win32 - {BF3C905E-512C-4E64-B737-A6C5B3A18C7E}.Release|Win32.Build.0 = Release|Win32 {873CFBF9-0D03-42D5-B2F9-A4C95A15EBCD}.Debug|Win32.ActiveCfg = Debug|Win32 {873CFBF9-0D03-42D5-B2F9-A4C95A15EBCD}.Debug|Win32.Build.0 = Debug|Win32 {873CFBF9-0D03-42D5-B2F9-A4C95A15EBCD}.Release|Win32.ActiveCfg = Release|Win32 {873CFBF9-0D03-42D5-B2F9-A4C95A15EBCD}.Release|Win32.Build.0 = Release|Win32 + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Debug|Win32.ActiveCfg = Debug|Win32 + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Debug|Win32.Build.0 = Debug|Win32 + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release|Win32.ActiveCfg = Release|Win32 + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release|Win32.Build.0 = Release|Win32 + {DA7BBAE5-1C1A-4B5E-ABF1-2B5090DB2988}.Debug|Win32.ActiveCfg = Debug|Win32 + {DA7BBAE5-1C1A-4B5E-ABF1-2B5090DB2988}.Debug|Win32.Build.0 = Debug|Win32 + {DA7BBAE5-1C1A-4B5E-ABF1-2B5090DB2988}.Release|Win32.ActiveCfg = Release|Win32 + {DA7BBAE5-1C1A-4B5E-ABF1-2B5090DB2988}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: trunk/Loki.workspace =================================================================== --- trunk/Loki.workspace 2012-04-03 05:46:56 UTC (rev 1183) +++ trunk/Loki.workspace 2013-06-19 02:23:00 UTC (rev 1184) @@ -14,7 +14,7 @@ <Project filename="test/Factory/Factory.cbp" /> <Project filename="test/flex_string/flex_string.cbp" /> <Project filename="test/Function/Function.cbp" /> - <Project filename="test/LevelMutex/LevelMutex.cbp" active="1"> + <Project filename="test/LevelMutex/LevelMutex.cbp"> <Depends filename="Loki.cbp" /> </Project> <Project filename="test/Lockable/Lockable.cbp"> @@ -50,5 +50,8 @@ <Project filename="test/SmallObj/SmallObjSingleton.cbp"> <Depends filename="Loki.cbp" /> </Project> + <Project filename="test/SmartAssert/SmartAssert.cbp" active="1"> + <Depends filename="Loki.cbp" /> + </Project> </Workspace> </CodeBlocks_workspace_file> Added: trunk/include/loki/Concatenate.h =================================================================== --- trunk/include/loki/Concatenate.h (rev 0) +++ trunk/include/loki/Concatenate.h 2013-06-19 02:23:00 UTC (rev 1184) @@ -0,0 +1,38 @@ +//////////////////////////////////////////////////////////////////////////////// +// The Loki Library +// Copyright (c) 2013 by Rich Sposato +// Code covered by the MIT License +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +//////////////////////////////////////////////////////////////////////////////// + +#ifndef LOKI_MACRO_CONCATENATE_INC_ +#define LOKI_MACRO_CONCATENATE_INC_ + +// $Id$ + +/** @note This header file provides a common definition of macros used to + concatenate names or numbers together into a single name or number. + */ + +#define LOKI_CONCATENATE_DIRECT(s1, s2) s1##s2 +#define LOKI_CONCATENATE(s1, s2) LOKI_CONCATENATE_DIRECT(s1, s2) + + +#endif Property changes on: trunk/include/loki/Concatenate.h ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Modified: trunk/include/loki/ScopeGuard.h =================================================================== --- trunk/include/loki/ScopeGuard.h 2012-04-03 05:46:56 UTC (rev 1183) +++ trunk/include/loki/ScopeGuard.h 2013-06-19 02:23:00 UTC (rev 1184) @@ -31,7 +31,9 @@ #include <exception> // needed for calls to uncaught_exception. #include <loki/RefToValue.h> +#include <loki/Concatenate.h> + /// \defgroup ExceptionGroup Exception-safe code namespace Loki @@ -699,8 +701,6 @@ } // namespace Loki -#define LOKI_CONCATENATE_DIRECT(s1, s2) s1##s2 -#define LOKI_CONCATENATE(s1, s2) LOKI_CONCATENATE_DIRECT(s1, s2) #define LOKI_ANONYMOUS_VARIABLE(str) LOKI_CONCATENATE(str, __LINE__) #define LOKI_ON_BLOCK_EXIT ::Loki::ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = ::Loki::MakeGuard Added: trunk/include/loki/SmartAssert.hpp =================================================================== --- trunk/include/loki/SmartAssert.hpp (rev 0) +++ trunk/include/loki/SmartAssert.hpp 2013-06-19 02:23:00 UTC (rev 1184) @@ -0,0 +1,666 @@ +//////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2013 by Rich Sposato +// Code covered by the MIT License +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +//////////////////////////////////////////////////////////////////////////////// + + +#ifndef LOKI_SMART_ASSERT_HPP_INCLUDED +#define LOKI_SMART_ASSERT_HPP_INCLUDED + + +#include <loki/Concatenate.h> + +#if defined ( DEBUG ) || defined( DEBUG_ ) || defined( _DEBUG ) + #define LOKI_SMART_ASSERT_DEBUG +#endif + +#if defined( _MSC_VER ) + #pragma warning( push ) + #pragma warning( disable : 4514 ) + #pragma warning( disable : 4711 ) +#endif + +#if !defined( nullptr ) + #define LOKI_DEFINED_NULLPTR + #define nullptr 0 +#endif + + +namespace Loki +{ + +// --------------------------------------------------------------------- + +/** + @par SmartAssert Versus Dumb Assertions + Loki's SmartAssert provides features traditional assertions don't. + - Add a meaningful message to each assertion. + - Output values of variables when assertions fail. + - Different severity levels per assertion. + - Allows program to do something besides abort when assertions fail. + - Can ask user how to respond to assertions instead of just failing. + - Customizable output. + - Customizable way to ask user for response. + - Customizable way to start debugger. + - Allows program to do cleanup before dying. + + @par How to Use SmartAssert in 5 Minutes + The simplest way to use Loki's SmartAssert is to follow these steps. This is + the simplest way to use SmartAssert, and it gives you the same (or similar) + behaviors as assert. + - Add this line to your file: #include <loki/SmartAssert.hpp> + - Replace "assert( condition );" with "LOKI_SMART_ASSERT( condition );" + - Make sure you define one of these macros: DEBUG, _DEBUG, or DEBUG_. + - Compile and run your program. + + @par Adding Messages to your Assertions. + SmartAssert can output simple C-style strings as messages when an assertion + fails. Each assertion may have only one message. If you add more than one, + then only the right-most message is sent to output. To add a simple message + to your assertions, use the .Msg() function. + @code + LOKI_SMART_ASSERT( cond ).Msg( "Something is rotten in the state of Denmark." ); + @endcode + + @par Adding Variables to Your Assertions. + You can make SmartAssert output the values of variables by adding each + variable within a pair of parantheses. It will output them in the same order + they were added. You may chain as many variables to the assertion, but you + may only place fundamental types in the assertion. You can put them in any + order, but SmartAssert will store and output them in the reverse order in + which you add them. (i.e. Leftmost variables get outputted last, and + rightmost ones get outputted first.) Storing them in reverse order makes an + efficiency gain of O(n) over O(n*n). + @code + LOKI_SMART_ASSERT( cond )( a )( b ); + LOKI_SMART_ASSERT( cond )( a )( e )( c )( b )( d ); + @endcode + + SmartAssert won't know the purpose of those variables; only their type and + value. You can make SmartAssert output the names of the variables by using + the "stringify" preprocessor operator. This causes SmartAssert to create a + separate storage for the name and the variable itself. + @code + LOKI_SMART_ASSERT( cond )( a )( "a" )( b )( "b" ); + LOKI_SMART_ASSERT( cond )( a )( "a" )( e )( "e" )( b )( "b" ); + @endcode + + @par Setting the Severity Level + Assertions treat all error conditions as an excuse to commit suicide. That + one-size-fits-all solution seems overly drastic for minor errors. At least + SmartAssert gives the developer more detailed output to help understand why + the program died. + + SmartAssert provides multiple severity levels so developers have more options + besides seeing their programs die. The basic options are to start a debugger, + ignore the assertion that time, ignore it as long as the program runs, or + stop the program. The four severity levels and their effects are: + - Info: Just output the assertion info and continue on. + - Warn: Ask user to either ignore now, ignore always, or start debugger. + - Error: Same as above, but also give user option to abort program. + - Fatal: Program always ends when assertion fails and never asks user. + + SmartAssert's default severity level is Fatal so you can use it as a drop-in + replacement for assert and still get the same behavior. + + Here are some example calls to set the severity level. As you can see, the + calls may occur in any order within the assertion. + @code + LOKI_SMART_ASSERT( cond )( a )( b ).Info(); + LOKI_SMART_ASSERT( cond ).Warn()( a )( b ); + LOKI_SMART_ASSERT( cond )( a ).Error().( b ); + LOKI_SMART_ASSERT( cond ).Fatal().Msg( "Goodbye cruel world!" ); + LOKI_SMART_ASSERT( cond )( d ); // No severity level implies Fatal! + @endcode + + You could specify more than one severity level, but only the rightmost call + matters. In this example, Info() is further to the right so it overrides the + Fatal() call. + @code + LOKI_SMART_ASSERT( cond ).Fatal()( a )( b ).Info(); + @endcode + + @par User Intervention. + Since SmartAssert's default behaviors mimic assert, it normally doesn't ask + the user how to respond to an assertion failure. SmartAssert asks the user + only if the developer puts a call to operator() at the end of the assertion. + There is no need to ask the user to intervene if the severity level is Info. + If you write a policy class to either ask the user or call the debugger, you + should always add the call to operator(). + @code + LOKI_SMART_ASSERT( cond ).Warn()( a )(); // Asks user to intervene. + LOKI_SMART_ASSERT( cond ).Warn()( a ); // Does not ask user. + @endcode + + @par Write Your Own Policy. + Many parts of Loki were implemented using policy-based software design, and + SmartAssert follows that tradition. SmartAssert has a default policy that + mimics the behaviors of assert. If you want to make your own policy class, + write that class to have the same function signatures as + CommandLineAssertPolicy, and use the LOKI_SMART_ASSERT_POLICIED macro instead + of LOKI_SMART_ASSERT. + + @par Potential Policies + - To call a special debugger rather than the default one. + - To send output to a log file instead of to cout. + - To create a popup dialog box to ask the user. + - To attempt last moment cleanup before the program dies. + + @code + class MyPolicy + { + static void Output( const SmartAssertBase * asserter ); + static void Debugger( const SmartAssertBase * asserter ); + static SmartAssertBase::UserResponse AskUser( const SmartAssertBase * asserter ); + static void AbortNow( const SmartAssertBase * asserter ); + }; + LOKI_SMART_ASSERT_POLICIED( cond, MyPolicy ); + @endcode + + @par Thread Safety. + Each SmartAssert object is declared locally within a function, so it is only + accessible by the thread executing it. However, each SmartAssert makes its + own static boolean flag for whether to ignore its future failures. That + boolean flag is not thread_local, so telling SmartAssert to ignore it each + time applies to all threads. SmartAssert relies on a policy class, so it is + only as thread-safe as the functions in its policy class. + + @par Exception Safety. + SmartAssert wraps calls to the policy class within try-catch blocks. If an + exception occurs for Info or Warning level conditions, SmartAssert stops + processing the assertion and allows the calling function to continue. If an + exception occurs when processing an Error or Fatal assertion, SmartAssert + will abort immediately. + + @par Memory Usage. + SmartAssert does not allocate any memory or other resources, but functions + within policy classes might. + + @par Run-Time Efficiency. + No function call or operation within SmartAssert takes more than O(n) steps, + where n is the number of variables passed into SmartAssert. Most actions + complete in constant time. Functions in policy classes may not have the same + low run-time efficiency. +*/ + +// --------------------------------------------------------------------- + +/** @class AssertInfo Stores extra info user wants to pass into assertion. + This class has one constructor for each primitive data type so developers + can pass any primitive variable into the assert. + */ +class AssertInfo +{ +public: + + /** @enum DataTypeTag One tag for each primitive data type, plus a + few for pointers to char data types. + */ + enum DataTypeTag + { + Unknown = 0, + Boolean, + JustChar, + SignedChar, + UnsignedChar, + SignedShort, + UnsignedShort, + JustInt, + SignedInt, + UnsignedInt, + Long, + UnsignedLong, + LongInt, + UnsignedLongInt, + CharPtr, + SignedCharPtr, + UnsignedCharPtr, + VoidPtr, + Float, + Double, + LongDouble, + }; + + static const char * GetName( DataTypeTag tag ); + + /// @union DataValue Can be configured as any primitive data type. + union DataValue + { + bool m_bool; + char m_char; + signed char m_s_char; + unsigned char m_u_char; + signed short int m_s_short; + unsigned short int m_u_short; + int m_int; + unsigned int m_u_int; + long m_long; + unsigned long m_u_long; + signed long long int m_s_long_int; + unsigned long long int m_u_long_int; + const char * m_p_char; + const signed char * m_p_s_char; + const unsigned char * m_p_u_char; + const void * m_p_v; + float m_float; + double m_double; + long double m_l_double; + + DataValue() : m_bool( true ) {} + DataValue( const bool v ) : m_bool( v ) {} + DataValue( const char v ) : m_char( v ) {} + DataValue( const signed char v ) : m_s_char( v ) {} + DataValue( const unsigned char v ) : m_u_char( v ) {} + DataValue( const signed short int v ) : m_s_short( v ) {} + DataValue( const unsigned short int v ) : m_u_short( v ) {} + DataValue( const int v ) : m_int( v ) {} + DataValue( const unsigned int v ) : m_u_int( v ) {} + DataValue( const long v ) : m_long( v ) {} + DataValue( const unsigned long v ) : m_u_long( v ) {} + DataValue( const long long int v ) : m_s_long_int( v ) {} + DataValue( const unsigned long long int v ) : m_u_long_int( v ) {} + DataValue( const char * v ) : m_p_char( v ) {} + DataValue( const signed char * v ) : m_p_s_char( v ) {} + DataValue( const unsigned char * v ) : m_p_u_char( v ) {} + DataValue( const void * v ) : m_p_v( v ) {} + DataValue( const float v ) : m_float( v ) {} + DataValue( const double v ) : m_double( v ) {} + DataValue( const long double v ) : m_l_double( v ) {} + + void Output( DataTypeTag type ) const; + }; + + AssertInfo() : m_type( Unknown ), m_value(), m_next( nullptr ) {} + AssertInfo( bool v ) : m_type( Boolean ), m_value( v ), m_next( nullptr ) {} + AssertInfo( char v ) : m_type( JustChar ), m_value( v ), m_next( nullptr ) {} + AssertInfo( signed char v ) : m_type( SignedChar ), m_value( v ), m_next( nullptr ) {} + AssertInfo( unsigned char v ) : m_type( UnsignedChar ), m_value( v ), m_next( nullptr ) {} + AssertInfo( signed short v ) : m_type( SignedShort ), m_value( v ), m_next( nullptr ) {} + AssertInfo( unsigned short v ) : m_type( UnsignedShort ), m_value( v ), m_next( nullptr ) {} + AssertInfo( signed int v ) : m_type( SignedInt ), m_value( v ), m_next( nullptr ) {} + AssertInfo( unsigned int v ) : m_type( UnsignedInt ), m_value( v ), m_next( nullptr ) {} + AssertInfo( long v ) : m_type( Long ), m_value( v ), m_next( nullptr ) {} + AssertInfo( unsigned long v ) : m_type( UnsignedLong ), m_value( v ), m_next( nullptr ) {} + AssertInfo( long long int v ) : m_type( LongInt ), m_value( v ), m_next( nullptr ) {} + AssertInfo( unsigned long long int v ) : m_type( UnsignedLongInt ), m_value( v ), m_next( nullptr ) {} + AssertInfo( const char * v ) : m_type( CharPtr ), m_value( v ), m_next( nullptr ) {} + AssertInfo( const signed char * v ) : m_type( SignedCharPtr ), m_value( v ), m_next( nullptr ) {} + AssertInfo( const unsigned char * v ) : m_type( UnsignedCharPtr ), m_value( v ), m_next( nullptr ) {} + AssertInfo( const void * v ) : m_type( VoidPtr ), m_value( v ), m_next( nullptr ) {} + AssertInfo( float v ) : m_type( Float ), m_value( v ), m_next( nullptr ) {} + AssertInfo( double v ) : m_type( Double ), m_value( v ), m_next( nullptr ) {} + AssertInfo( long double v ) : m_type( LongDouble ), m_value( v ), m_next( nullptr ) {} + + /// Function provides default output action. + void Output() const; + + DataTypeTag m_type; ///< What type of data this stores. + DataValue m_value; ///< Value of that data. + mutable const AssertInfo * m_next; ///< Pointer to next piece of info, if any. +}; + +// --------------------------------------------------------------------- + +/** @class AssertContext Stores info about file, line, and function + where assertion occurred. Only two or three of these per SmartAssert. + + @note This class is optimized for storing info about the assertion's + location, not for storing general values. Use AssertInfo for storing + values of arbitary primitive types. + */ +class AssertContext +{ +public: + + /// Constructs context for source code line within file. + AssertContext( const char * description, unsigned int line ); + + /// Constructs context for source code filename or function name. + AssertContext( const char * description, const char * value ); + + /// Function provides default output action. + void Output() const; + + unsigned int m_line; ///< Line number within file. + const char * m_value; ///< Pointer to either filename or function name. + const char * m_description; ///< C-style string for describing piece of context. + mutable const AssertContext * m_next; ///< Pointer to next piece of context, if any. +}; + +// --------------------------------------------------------------------- + +class SmartAssertBase +{ +public: + + enum SeverityLevel + { + Info_, ///< Just warn user and do nothing else. (same as Warning and Ignore-Each-Time) + Warn_, ///< Give user options: (Ignore Once, Ignore Always, Debug) + Error_, ///< Give user options: (Ignore Once, Ignore Always, Debug, Abort) + Fatal_ ///< Always abort on failure. User gets no option to choose otherwise. + }; + + /// @enum Possible replies by the user when asked what to do about assertion. + enum UserResponse + { + /// Program continues as if assertion never happened, and asks + /// user what to do when assertion occurs again. + IgnoreThisTime = 'I', + /// Program continues executing, and never checks assertion for + /// the rest of the program's execution. If the program ends and + /// restarts, SmartAssert will check it again. + IgnoreEachTime = 'E', + /// Start the debugger at the place where the assertion failed. + DebugNow = 'D', + /// End the program now. + AbortProgram = 'A' + }; + + /// Gets one word description of severity level. + static const char * GetName( SeverityLevel level ); + + /// These three C-style strings contain descriptions used for assertion contexts. + static const char * const FileDesc; + static const char * const LineDesc; + static const char * const FunctionDesc; + + mutable const AssertContext * m_context; /// Linked-list of contexts of where assertion occurred. + mutable const AssertInfo * m_info; ///< Linked-list of values provided for output purposes. + SeverityLevel m_level; ///< How bad is this assertion? + bool * m_ignore; ///< Pointer to ignore-always flag. + const char * m_expression; ///< Pointer to C-style string of failed assertion expression. + const char * m_message; ///< Simple message made by developer. + bool m_handled; ///< True if this assertion was handled before destructor. + +protected: + + /// Default constructor is used for release builds. It ignores assertions. + SmartAssertBase(); + + /** This constructor gets used in debug builds. + @param ignore Pointer to boolean flag to ignore this assertion each time. + @param expression C-style string showing failed assertion. + */ + SmartAssertBase( bool * ignore, const char * expression ); + + /// Destructor handles assertion only when if not handled earlier. + virtual ~SmartAssertBase(); + + /// Called by derived class to add context information. + SmartAssertBase & AddContext( const AssertContext & info ); + + /// Called by derived class to add values used to display info about assertion. + SmartAssertBase & AddInfo( const AssertInfo & info ); + + /// Called to handle assertion failure. + void HandleFailure(); + + /// Default implementation of code to output information about assertion. + virtual void CallOutput() const; + + /// Default implementation of code to call debugger. + virtual void CallDebugger() const; + + /// Default implementation of code to ask user what to do. + virtual UserResponse AskUser() const; + + /// Default implementation of code to abort program. + virtual void AbortNow() const; + + /// Ignore-always flag used by assertions created in release builds. + static bool s_alwaysIgnore; +}; + +// --------------------------------------------------------------------- + +/** @class CommandLineAssertPolicy Default policy for command line programs. + Developers can implement their own policies to handle assertions by making a + class with the same function signatures as this class. If you write your own + policy class, you should also use the LOKI_SMART_ASSERT_POLICIED macro, and + not the LOKI_SMART_ASSERT macro. +*/ +class CommandLineAssertPolicy +{ +public: + + /// Displays information about assertion to the user. + static void Output( const SmartAssertBase * asserter ); + + /// Asks user how to handle assertion. + static SmartAssertBase::UserResponse AskUser( const SmartAssertBase * asserter ); + + /// Calls debugger. + static void Debugger( const SmartAssertBase * asserter ); + + /// This call should end the program. + static void AbortNow( const SmartAssertBase * asserter ); + +}; + +// --------------------------------------------------------------------- + +/** @class class SmartAssert + */ +template< class AssertPolicy > +class SmartAssert : public SmartAssertBase +{ +public: + + /// Default constructor used for when assertion passes. Should get optimized away. + SmartAssert() : SmartAssertBase() {} + + /// Constructor used when assertion fails. + SmartAssert( bool * ignore, const char * expression ) + : SmartAssertBase( ignore, expression ) {} + + /// Destructor is trivial. + virtual ~SmartAssert() {} + + /// Provides simple hard-coded C-style string message for output. + SmartAssert & Msg( const char * message ) { m_message = message; return *this; } + + SmartAssert & Info() { m_level = SmartAssertBase::Info_; return *this; } + SmartAssert & Warn() { m_level = SmartAssertBase::Warn_; return *this; } + SmartAssert & Error() { m_level = SmartAssertBase::Error_; return *this; } + SmartAssert & Fatal() { m_level = SmartAssertBase::Fatal_; return *this; } + + /// Called to do non-default actions when assertion fails. + void operator ()() { HandleFailure(); } + + /// Adds one piece of information to assertion, generally a variable or result of function call. + SmartAssert & operator ()( const AssertInfo & info ) + { + return static_cast< SmartAssert & >( AddInfo( info ) ); + } + + /// Called to add one piece of context to assertion, such as filename, line, or function name. + SmartAssert & Add( const AssertContext & info ) + { + return static_cast< SmartAssert & >( AddContext( info ) ); + } + +private: + + virtual void CallOutput() const + { + AssertPolicy::Output( dynamic_cast< const SmartAssertBase * >( this ) ); + } + + virtual void CallDebugger() const + { + AssertPolicy::Debugger( dynamic_cast< const SmartAssertBase * >( this ) ); + } + + virtual SmartAssertBase::UserResponse AskUser() const + { + return AssertPolicy::AskUser( dynamic_cast< const SmartAssertBase * >( this ) ); + } + + virtual void AbortNow() const + { + AssertPolicy::AbortNow( dynamic_cast< const SmartAssertBase * >( this ) ); + } + +}; + +// --------------------------------------------------------------------- + +} // namespace Loki + + +/// These lines let Loki put filename and line into AssertContext. +// note: using 'const char LOKI_SMART_ASSERT_FILE[] = __FILE__' +// does not work, since __FILE__ = "SmartAssert.hpp" +#define LOKI_SMART_ASSERT_FILE __FILE__ +#define LOKI_USE_NUMBER_FOR_UNIQUE_NAME __LINE__ + + +/** These lines determine if Loki can get the function name into AssertContext. + They also declare the macro used for creating unique names for SmartAssert + classes and variables. + */ +#define LOKI_SMART_ASSERT_FUNCTION_EXISTS + +#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) + # define LOKI_SMART_ASSERT_FUNCTION __PRETTY_FUNCTION__ + # undef LOKI_USE_NUMBER_FOR_UNIQUE_NAME + # define LOKI_USE_NUMBER_FOR_UNIQUE_NAME __COUNTER__ + +#elif defined(__FUNCSIG__) + # define LOKI_SMART_ASSERT_FUNCTION __FUNCSIG__ + +#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550) + # define LOKI_SMART_ASSERT_FUNCTION __FUNC__ + +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) + # define LOKI_SMART_ASSERT_FUNCTION __func__ + +#elif (defined __MSC_VER) && (__MSC_VER >= 1300) + # define LOKI_SMART_ASSERT_FUNCTION __FUNCDNAME__ + # undef LOKI_USE_NUMBER_FOR_UNIQUE_NAME + # define LOKI_USE_NUMBER_FOR_UNIQUE_NAME __COUNTER__ + +#elif defined(__IBMCPP__) && (__IBMCPP__ <= 500) + # define LOKI_SMART_ASSERT_FUNCTION __FUNCTION__ + +#elif (defined __HP_aCC) && (__HP_aCC <= 33300) + # define LOKI_SMART_ASSERT_FUNCTION __FUNCTION__ + +#else + # undef LOKI_SMART_ASSERT_FUNCTION_EXISTS +#endif + +#define LOKI_MAKE_UNIQUE_NAME( str ) LOKI_CONCATENATE( str, LOKI_USE_NUMBER_FOR_UNIQUE_NAME ) +#define LOKI_SMART_ASSERT_IGNORE_NAME LOKI_MAKE_UNIQUE_NAME( smartAssert_ignore_ ) +#define LOKI_SMART_ASSERT_CLASS_NAME LOKI_MAKE_UNIQUE_NAME( SmartAssert_ ) +#define LOKI_SMART_ASSERT_HIDDEN_CLASS LOKI_SMART_ASSERT_CLASS( LOKI_SMART_ASSERT_CLASS_NAME, LOKI_SMART_ASSERT_IGNORE_NAME ) + + +// --------------------------------------------------------------------- + +// @note This checks if LOKI_SMART_ASSERT_CONTEXT was defined already in +// case developers made their own context-creating macro. If you make +// your own context chain, follow the example here and expect SmartAssert +// to display the context information in the reverse order of how they +// are added here. (e.g. - The contexts are added in function-line-file +// order, but shown in file-line-function order.) +#ifndef LOKI_SMART_ASSERT_CONTEXT + + #ifdef LOKI_SMART_ASSERT_FUNCTION_EXISTS + #define LOKI_SMART_ASSERT_CONTEXT \ + Add( ::Loki::AssertContext( ::Loki::SmartAssertBase::FunctionDesc, LOKI_SMART_ASSERT_FUNCTION ) ). \ + Add( ::Loki::AssertContext( ::Loki::SmartAssertBase::LineDesc, __LINE__ ) ). \ + Add( ::Loki::AssertContext( ::Loki::SmartAssertBase::FileDesc, LOKI_SMART_ASSERT_FILE ) ) + #else + #define LOKI_SMART_ASSERT_CONTEXT \ + Add( ::Loki::AssertContext( ::Loki::SmartAssertBase::LineDesc, __LINE__ ) ). \ + Add( ::Loki::AssertContext( ::Loki::SmartAssertBase::FileDesc, LOKI_SMART_ASSERT_FILE ) ) + #endif + +#endif // LOKI_SMART_ASSERT_CONTEXT + + +// --------------------------------------------------------------------- + +#define LOKI_MAKE_SMART_ASSERT( class_name, ignore_var_name, expr ) \ + static bool ignore_var_name = false; \ + class class_name : public ::Loki::SmartAssert< ::Loki::CommandLineAssertPolicy > \ + { public: \ + typedef ::Loki::SmartAssert< ::Loki::CommandLineAssertPolicy > BaseClass; \ + class_name( bool * ignore, const char * expression ) \ + : BaseClass( ignore, expression ) {} \ + virtual ~class_name() {} \ + }; \ + if ( ignore_var_name || ( expr ) ) ; else \ + class_name( &ignore_var_name, #expr ).LOKI_SMART_ASSERT_CONTEXT + + +#ifdef LOKI_SMART_ASSERT_DEBUG + #define LOKI_SMART_ASSERT( expr ) \ + LOKI_MAKE_SMART_ASSERT( LOKI_SMART_ASSERT_CLASS_NAME, LOKI_SMART_ASSERT_IGNORE_NAME, (expr) ) + +#else + #define LOKI_SMART_ASSERT( expr ) \ + if ( true ) ; else \ + ::Loki::SmartAssert< ::Loki::CommandLineAssertPolicy >() + // Do nothing. Compiler should optimize away the else branch. +#endif + + +// --------------------------------------------------------------------- + +#define LOKI_MAKE_SMART_ASSERT_POLICIED( class_name, ignore_var_name, expr, policy ) \ + static bool ignore_var_name = false; \ + class class_name : public ::Loki::SmartAssert< policy > \ + { public: \ + typedef ::Loki::SmartAssert< policy > BaseClass; \ + class_name( bool * ignore, const char * expression ) \ + : BaseClass( ignore, expression ) {} \ + virtual ~class_name() {} \ + }; \ + if ( ignore_var_name || ( expr ) ) ; else \ + class_name( &ignore_var_name, #expr ).LOKI_SMART_ASSERT_CONTEXT + + +#ifdef LOKI_SMART_ASSERT_DEBUG + #define LOKI_SMART_ASSERT_POLICIED( expr, policy ) \ + LOKI_MAKE_SMART_ASSERT_POLICIED( LOKI_SMART_ASSERT_CLASS_NAME, LOKI_SMART_ASSERT_IGNORE_NAME, (expr), policy ) + +#else + #define LOKI_SMART_ASSERT_POLICIED( expr, policy ) \ + if ( true ) ; else \ + ::Loki::SmartAssert< policy >() + // Do nothing. Compiler should optimize away the else branch. +#endif + +// --------------------------------------------------------------------- + +#if defined( LOKI_DEFINED_NULLPTR ) + #undef LOKI_DEFINED_NULLPTR + #undef nullptr +#endif + +#if defined( _MSC_VER ) + #pragma warning( pop ) +#endif + +#endif // LOKI_SMART_ASSERT_HPP_INCLUDED Property changes on: trunk/include/loki/SmartAssert.hpp ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: trunk/src/SmartAssert.cpp =================================================================== --- trunk/src/SmartAssert.cpp (rev 0) +++ trunk/src/SmartAssert.cpp 2013-06-19 02:23:00 UTC (rev 1184) @@ -0,0 +1,527 @@ +//////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2013 by Rich Sposato +// Code covered by the MIT License +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +//////////////////////////////////////////////////////////////////////////////// + + +#include <loki/SmartAssert.hpp> + +#if defined( _WIN32 ) || defined( __WIN32__ ) || defined( WIN32 ) + #include <Windows.h> +#endif + +#include <iostream> + +#include <cassert> +#include <cstdlib> + +#if defined( _MSC_VER ) + #pragma warning( push ) + #pragma warning( disable : 4365 ) + #pragma warning( disable : 4514 ) + #pragma warning( disable : 4710 ) + #pragma warning( disable : 4711 ) +#endif + +#if !defined( nullptr ) + #define nullptr 0 +#endif + + +using namespace ::std; + +namespace Loki +{ + +bool SmartAssertBase::s_alwaysIgnore = true; + +const char * const SmartAssertBase::FileDesc = "file"; +const char * const SmartAssertBase::LineDesc = "line"; +const char * const SmartAssertBase::FunctionDesc = "function"; + + +// --------------------------------------------------------------------- + +const char * AssertInfo::GetName( DataTypeTag tag ) +{ + switch ( tag ) + { + case Unknown: return "Unknown"; + case Boolean: return "boolean"; + case JustChar: return "char"; + case SignedChar: return "signed char"; + case UnsignedChar: return "char"; + case SignedShort: return "signed short"; + case UnsignedShort: return "unsigned short"; + case JustInt: return "int"; + case SignedInt: return "signed int"; + case UnsignedInt: return "unsigned int"; + case Long: return "long"; + case UnsignedLong: return "unsigned long"; + case LongInt: return "long int"; + case UnsignedLongInt: return "unsigned long int"; + case CharPtr: return "char *"; + case SignedCharPtr: return "signed char *"; + case UnsignedCharPtr: return "unsigned char *"; + case VoidPtr: return "void *"; + case Float: return "float"; + case Double: return "double"; + case LongDouble: return "long double"; + default: break; + } + return "undefined data type"; +} + +// --------------------------------------------------------------------- + +void AssertInfo::DataValue::Output( DataTypeTag theType ) const +{ + switch ( theType ) + { + case Unknown: + { + cout << "\t Error! Unknown data type! " << theType; + break; + } + case Boolean: + { + const char * message = m_bool ? "true" : "false"; + cout << message; + break; + } + case JustChar: + { + cout << m_char; + break; + } + case SignedChar: + { + cout << m_s_char; + break; + } + case UnsignedChar: + { + cout << m_u_char; + break; + } + case SignedShort: + { + cout << m_s_short; + break; + } + case UnsignedShort: + { + cout << m_u_short; + break; + } + case JustInt: + { + cout << m_int; + break; + } + case SignedInt: + { + cout << m_int; + break; + } + case UnsignedInt: + { + cout << m_u_int; + break; + } + case Long: + { + cout << m_long; + break; + } + case UnsignedLong: + { + cout << m_u_long; + break; + } + case LongInt: + { + cout << m_s_long_int; + break; + } + case UnsignedLongInt: + { + cout << m_u_long_int; + break; + } + case CharPtr: + { + cout << m_p_char; + break; + } + case SignedCharPtr: + { + cout << m_p_s_char; + break; + } + case UnsignedCharPtr: + { + cout << m_p_u_char; + break; + } + case VoidPtr: + { + cout << m_p_v; + break; + } + case Float: + { + cout << m_float; + break; + } + case Double: + { + cout << m_double; + break; + } + case LongDouble: + { + cout << m_l_double; + break; + } + default: + { + cout << "\t Error! Undefined data type! " << theType; + break; + } + } +} + +// --------------------------------------------------------------------- + +void AssertInfo::Output() const +{ + cout << "\t" << GetName( m_type ) << ": "; + m_value.Output( m_type ); + cout << endl; +} + +// --------------------------------------------------------------------- + +AssertContext::AssertContext( const char * description, unsigned int line ) + : m_line( line ) + , m_value( nullptr ) + , m_description( description ) + , m_next( nullptr ) +{ +} + +// --------------------------------------------------------------------- + +AssertContext::AssertContext( const char * description, const char * value ) + : m_line( 0 ) + , m_value( value ) + , m_description( description ) + , m_next( nullptr ) +{ +} + +// --------------------------------------------------------------------- + +void AssertContext::Output() const +{ + cout << m_description << ": "; + if ( m_value != nullptr ) + { + cout << m_value; + } + else + { + cout << m_line; + } +} + +// --------------------------------------------------------------------- + +const char * SmartAssertBase::GetName( SeverityLevel level ) +{ + switch ( level ) + { + case Info_: return "Info"; + case Warn_: return "Warning"; + case Error_: return "Error"; + case Fatal_: return "Fatal"; + } + return "unknown"; +} + +// --------------------------------------------------------------------- + +SmartAssertBase::SmartAssertBase() + : m_context( nullptr ) + , m_info( nullptr ) + , m_level( Warn_ ) + , m_ignore( &s_alwaysIgnore ) + , m_expression( nullptr ) + , m_message( nullptr ) + , m_handled( false ) +{ +} + +// --------------------------------------------------------------------- + +SmartAssertBase::SmartAssertBase( bool * ignore, const char * expression ) + : m_context( nullptr ) + , m_info( nullptr ) + , m_level( Fatal_ ) ///< @note Default level is fatal to match behavior of assert. + , m_ignore( ignore ) + , m_expression( expression ) + , m_message( nullptr ) + , m_handled( false ) +{ +} + +// --------------------------------------------------------------------- + +SmartAssertBase::~SmartAssertBase() +{ + if ( m_handled ) + { + return; + } + + try + { + CallOutput(); + if ( ( Fatal_ == m_level ) || ( Error_ == m_level ) ) + { + AbortNow(); + } + } + catch ( ... ) + { + if ( ( Fatal_ == m_level ) || ( Error_ == m_level ) ) + { + // In other situations, I might allow a destructor to do nothing + // when an exception occurs, but since this exception occurred + // while processing a failed assertion, it is probably not safe + // to ignore the exception. Just end the program abruptly. + ::std::abort(); + } + } +} + +// --------------------------------------------------------------------- + +SmartAssertBase & SmartAssertBase::AddContext( const AssertContext & context ) +{ + // Contexts are always added to the head of the linked-list since that + // is cheaper than traversing the list every time, but the list is in + // reverse order from how the entries are declared. + assert( m_context != &context ); + context.m_next = m_context; + m_context = &context; + return *this; +} + +// --------------------------------------------------------------------- + +SmartAssertBase & SmartAssertBase::AddInfo( const AssertInfo & info ) +{ + // AssertInfo's are always added to the head of the linked-list since + // that is cheaper than traversing the list every time, but the list + // is in reverse order from how the entries are declared. + assert( m_info != &info ); + info.m_next = m_info; + m_info = &info; + return *this; +} + +// --------------------------------------------------------------------- + +void SmartAssertBase::CallOutput() const +{ + CommandLineAssertPolicy::Output( this ); +} + +// --------------------------------------------------------------------- + +void SmartAssertBase::CallDebugger() const +{ + CommandLineAssertPolicy::Debugger( this ); +} + +// --------------------------------------------------------------------- + +SmartAssertBase::UserResponse SmartAssertBase::AskUser() const +{ + return CommandLineAssertPolicy::AskUser( this ); +} + +// --------------------------------------------------------------------- + +void SmartAssertBase::AbortNow() const +{ + CommandLineAssertPolicy::AbortNow( this ); +} + +// --------------------------------------------------------------------- + +void SmartAssertBase::HandleFailure() +{ + m_handled = true; + + try + { + if ( Info_ == m_level ) + { + CallOutput(); + return; + } + CallOutput(); + if ... [truncated message content] |
From: <ric...@us...> - 2013-06-24 06:09:37
|
Revision: 1189 http://sourceforge.net/p/loki-lib/code/1189 Author: rich_sposato Date: 2013-06-24 06:09:34 +0000 (Mon, 24 Jun 2013) Log Message: ----------- Use std namespace for C string functions. Modified Paths: -------------- trunk/include/loki/SafeFormat.h trunk/src/SafeFormat.cpp Modified: trunk/include/loki/SafeFormat.h =================================================================== --- trunk/include/loki/SafeFormat.h 2013-06-24 06:08:05 UTC (rev 1188) +++ trunk/include/loki/SafeFormat.h 2013-06-24 06:09:34 UTC (rev 1189) @@ -35,7 +35,6 @@ #include <cstdio> #include <climits> -#include <string> #include <cstring> #include <stdexcept> #include <utility> @@ -254,7 +253,7 @@ result_ = -1; return *this; } - const size_t len = std::min(std::strlen(s), prec_); + const size_t len = std::min(::std::strlen(s), prec_); if (width_ > len) { if (LeftJustify()) { Write(s, s + len); @@ -309,7 +308,7 @@ SetAlternateForm(); // printed with '0x' in front isSigned = true; // that's what gcc does } - if (!strchr("cdiuoxX", formatChar)) { + if (!::std::strchr("cdiuoxX", formatChar)) { result_ = -1; return; } @@ -404,7 +403,7 @@ // enforce format string validity ReadLeaders(); // enforce format spec - if (!strchr(check_fmt_char, *format_)) { + if (!::std::strchr(check_fmt_char, *format_)) { result_ = -1; return; } @@ -434,7 +433,7 @@ result_ = -1; return; } - Write(resultBuf, resultBuf + strlen(resultBuf)); + Write(resultBuf, resultBuf + ::std::strlen(resultBuf)); Advance(); // output stuff to the next format directive } Modified: trunk/src/SafeFormat.cpp =================================================================== --- trunk/src/SafeFormat.cpp 2013-06-24 06:08:05 UTC (rev 1188) +++ trunk/src/SafeFormat.cpp 2013-06-24 06:09:34 UTC (rev 1189) @@ -132,7 +132,7 @@ } PrintfState<std::string&, char> SPrintf(std::string& s, const char* format) { - const size_t estimate = ::strlen( format ) + 128; + const size_t estimate = ::std::strlen( format ) + 128; s.reserve( estimate ); return PrintfState<std::string&, char>(s, format); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2013-08-06 22:56:33
|
Revision: 1191 http://sourceforge.net/p/loki-lib/code/1191 Author: rich_sposato Date: 2013-08-06 22:56:31 +0000 (Tue, 06 Aug 2013) Log Message: ----------- Improved SmartAssert component. Modified Paths: -------------- trunk/Loki.sln trunk/include/loki/SmartAssert.hpp trunk/src/SmartAssert.cpp trunk/test/SmartAssert/SmartAssert.cbp trunk/test/SmartAssert/main.cpp Modified: trunk/Loki.sln =================================================================== --- trunk/Loki.sln 2013-06-24 06:10:50 UTC (rev 1190) +++ trunk/Loki.sln 2013-08-06 22:56:31 UTC (rev 1191) @@ -115,8 +115,6 @@ {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ThreadLocal", "test\ThreadLocal\ThreadLocal.vcxproj", "{27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Lockable", "test\Lockable\Lockable.vcxproj", "{22A34627-1480-4180-A8B6-4C05E77E27F8}" ProjectSection(ProjectDependencies) = postProject {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} @@ -127,13 +125,15 @@ {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "library", "src\Library.vcxproj", "{CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Library", "src\Library.vcxproj", "{CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmartAssert", "test\SmartAssert\SmartAssert.vcxproj", "{DA7BBAE5-1C1A-4B5E-ABF1-2B5090DB2988}" ProjectSection(ProjectDependencies) = postProject {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ThreadLocal", "test\ThreadLocal\ThreadLocal.vcxproj", "{27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -232,10 +232,6 @@ {0605A820-D075-48AC-ABB6-D3FF05D5CD1F}.Debug|Win32.Build.0 = Debug|Win32 {0605A820-D075-48AC-ABB6-D3FF05D5CD1F}.Release|Win32.ActiveCfg = Release|Win32 {0605A820-D075-48AC-ABB6-D3FF05D5CD1F}.Release|Win32.Build.0 = Release|Win32 - {27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}.Debug|Win32.ActiveCfg = Debug|Win32 - {27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}.Debug|Win32.Build.0 = Debug|Win32 - {27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}.Release|Win32.ActiveCfg = Release|Win32 - {27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}.Release|Win32.Build.0 = Release|Win32 {22A34627-1480-4180-A8B6-4C05E77E27F8}.Debug|Win32.ActiveCfg = Debug|Win32 {22A34627-1480-4180-A8B6-4C05E77E27F8}.Debug|Win32.Build.0 = Debug|Win32 {22A34627-1480-4180-A8B6-4C05E77E27F8}.Release|Win32.ActiveCfg = Release|Win32 @@ -252,6 +248,10 @@ {DA7BBAE5-1C1A-4B5E-ABF1-2B5090DB2988}.Debug|Win32.Build.0 = Debug|Win32 {DA7BBAE5-1C1A-4B5E-ABF1-2B5090DB2988}.Release|Win32.ActiveCfg = Release|Win32 {DA7BBAE5-1C1A-4B5E-ABF1-2B5090DB2988}.Release|Win32.Build.0 = Release|Win32 + {27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}.Debug|Win32.ActiveCfg = Debug|Win32 + {27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}.Debug|Win32.Build.0 = Debug|Win32 + {27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}.Release|Win32.ActiveCfg = Release|Win32 + {27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: trunk/include/loki/SmartAssert.hpp =================================================================== --- trunk/include/loki/SmartAssert.hpp 2013-06-24 06:10:50 UTC (rev 1190) +++ trunk/include/loki/SmartAssert.hpp 2013-08-06 22:56:31 UTC (rev 1191) @@ -104,8 +104,8 @@ @endcode @par Setting the Severity Level - Assertions treat all error conditions as an excuse to commit suicide. That - one-size-fits-all solution seems overly drastic for minor errors. At least + Typical assertions treat all error conditions as an excuse to commit suicide. + That one-size-fits-all solution seems overly drastic for minor errors. At least SmartAssert gives the developer more detailed output to help understand why the program died. @@ -153,20 +153,15 @@ @par Write Your Own Policy. Many parts of Loki were implemented using policy-based software design, and SmartAssert follows that tradition. SmartAssert has a default policy that - mimics the behaviors of assert. If you want to make your own policy class, - write that class to have the same function signatures as - CommandLineAssertPolicy, and use the LOKI_SMART_ASSERT_POLICIED macro instead - of LOKI_SMART_ASSERT. + mimics the behaviors of assert. You can implement your own policies to handle + assertions by making a class with the function signatures shown below. If you + write your own policy class, you should also use the LOKI_SMART_ASSERT_POLICIED + macro, and not the LOKI_SMART_ASSERT macro. - @par Potential Policies - - To call a special debugger rather than the default one. - - To send output to a log file instead of to cout. - - To create a popup dialog box to ask the user. - - To attempt last moment cleanup before the program dies. - @code class MyPolicy { + static bool FixedProblem( const SmartAssertBase * asserter ); static void Output( const SmartAssertBase * asserter ); static void Debugger( const SmartAssertBase * asserter ); static SmartAssertBase::UserResponse AskUser( const SmartAssertBase * asserter ); @@ -175,6 +170,16 @@ LOKI_SMART_ASSERT_POLICIED( cond, MyPolicy ); @endcode + @par Potential Policies You Can Create + - To provide a different output message than the default one. + - To call a special debugger rather than the default one. + - To send output to a log file, syslog, or cout, instead of to cerr. + - To create a popup dialog box to ask the user. + - To attempt last moment cleanup before the program dies. + - To correct the problem. + - To fix data invariants caused by the problem. + - Handle assertion by throwing exception. + @par Thread Safety. Each SmartAssert object is declared locally within a function, so it is only accessible by the thread executing it. However, each SmartAssert makes its @@ -239,6 +244,7 @@ LongDouble }; + /// Provides human readable name of data type. static const char * GetName( DataTypeTag tag ); /// @union DataValue Can be configured as any primitive data type. @@ -285,7 +291,11 @@ DataValue( const double v ) : m_double( v ) {} DataValue( const long double v ) : m_l_double( v ) {} - void Output( DataTypeTag type ) const; + /** Sends output of datatype and value to cerr or cout. + @param type What type of data is in the union. + @param use_cerr True to send output to standard error instead of standard out. + */ + void Output( DataTypeTag type, bool use_cerr ) const; }; AssertInfo() : m_type( Unknown ), m_value(), m_next( nullptr ) {} @@ -309,11 +319,13 @@ AssertInfo( double v ) : m_type( Double ), m_value( v ), m_next( nullptr ) {} AssertInfo( long double v ) : m_type( LongDouble ), m_value( v ), m_next( nullptr ) {} - /// Function provides default output action. - void Output() const; + /** Provides default output action. + @param use_cerr True to send output to standard error instead of standard out. + */ + void Output( bool use_cerr ) const; - DataTypeTag m_type; ///< What type of data this stores. - DataValue m_value; ///< Value of that data. + DataTypeTag m_type; ///< What type of data this stores. + DataValue m_value; ///< Value of that data. mutable const AssertInfo * m_next; ///< Pointer to next piece of info, if any. }; @@ -337,7 +349,7 @@ AssertContext( const char * description, const char * value ); /// Function provides default output action. - void Output() const; + void Output( bool use_cerr ) const; unsigned int m_line; ///< Line number within file. const char * m_value; ///< Pointer to either filename or function name. @@ -383,14 +395,16 @@ static const char * const LineDesc; static const char * const FunctionDesc; - mutable const AssertContext * m_context; /// Linked-list of contexts of where assertion occurred. - mutable const AssertInfo * m_info; ///< Linked-list of values provided for output purposes. - SeverityLevel m_level; ///< How bad is this assertion? - bool * m_ignore; ///< Pointer to ignore-always flag. - const char * m_expression; ///< Pointer to C-style string of failed assertion expression. - const char * m_message; ///< Simple message made by developer. - bool m_handled; ///< True if this assertion was handled before destructor. + /// @note All the variables are public so developers can access them through policy classes. + mutable const AssertContext * m_context; ///< Linked-list of contexts of where assertion occurred. + mutable const AssertInfo * m_info; ///< Linked-list of values provided for output purposes. + SeverityLevel m_level; ///< How bad is this assertion? + bool * m_ignore; ///< Pointer to ignore-always flag. + const char * m_expression; ///< Pointer to C-style string of failed assertion expression. + const char * m_message; ///< Simple message made by developer. + bool m_handled; ///< True if this assertion was handled before destructor. + protected: /// Default constructor is used for release builds. It ignores assertions. @@ -414,34 +428,38 @@ /// Called to handle assertion failure. void HandleFailure(); - /// Default implementation of code to output information about assertion. +private: + + /// @note Virtual functions are private to prevent policy classes from using them. + + /// Calls policy class to find out if host program fixed problem. + virtual bool FixedProblem() const = 0; + + /// Calls policy class to output information about assertion. virtual void CallOutput() const; - /// Default implementation of code to call debugger. - virtual void CallDebugger() const; + /// Calls policy class to invoke debugger. + virtual void CallDebugger() const = 0; - /// Default implementation of code to ask user what to do. - virtual UserResponse AskUser() const; + /// Calls policy class to ask user what to do. + virtual UserResponse AskUser() const = 0; - /// Default implementation of code to abort program. + /// Calls policy class to abort program. virtual void AbortNow() const; - - /// Ignore-always flag used by assertions created in release builds. - static bool s_alwaysIgnore; }; // --------------------------------------------------------------------- -/** @class CommandLineAssertPolicy Default policy for command line programs. - Developers can implement their own policies to handle assertions by making a - class with the same function signatures as this class. If you write your own - policy class, you should also use the LOKI_SMART_ASSERT_POLICIED macro, and - not the LOKI_SMART_ASSERT macro. +/** @class CoutAssertPolicy This is a policy for command line programs. It + sends assertion messages to the standard output stream, std::cout. */ -class CommandLineAssertPolicy +class CoutAssertPolicy { public: + /// SmartAssert will ignore error if this returns true. + static bool FixedProblem( const SmartAssertBase * asserter ); + /// Displays information about assertion to the user. static void Output( const SmartAssertBase * asserter ); @@ -458,6 +476,24 @@ // --------------------------------------------------------------------- +/** @class CerrAssertPolicy This is a policy for command line programs. It + sends assertion messages to the standard error stream, std::cerr. This is + the default policy for SmartAssert. +*/ +class CerrAssertPolicy : public CoutAssertPolicy +{ +public: + + /// Displays information about assertion to the user. + static void Output( const SmartAssertBase * asserter ); + + /// Asks user how to handle assertion. + static SmartAssertBase::UserResponse AskUser( const SmartAssertBase * asserter ); + +}; + +// --------------------------------------------------------------------- + /** @class class SmartAssert */ template< class AssertPolicy > @@ -486,7 +522,10 @@ /// Called to do non-default actions when assertion fails. void operator ()() { HandleFailure(); } - /// Adds one piece of information to assertion, generally a variable or result of function call. + /** Adds one piece of information to assertion, generally a variable or result of function call. + This function relies on conversion constructors in AssertInfo to create an AssertInfo from a + single variable. + */ SmartAssert & operator ()( const AssertInfo & info ) { return static_cast< SmartAssert & >( AddInfo( info ) ); @@ -500,21 +539,33 @@ private: + /// @note Virtual functions are private to prevent policy classes from using them. + + /// Calls policy class to find out if host program fixed problem. + virtual bool FixedProblem() const + { + return AssertPolicy::FixedProblem( dynamic_cast< const SmartAssertBase * >( this ) ); + } + + /// Calls policy class to output information about assertion. virtual void CallOutput() const { AssertPolicy::Output( dynamic_cast< const SmartAssertBase * >( this ) ); } + /// Calls policy class to invoke debugger. virtual void CallDebugger() const { AssertPolicy::Debugger( dynamic_cast< const SmartAssertBase * >( this ) ); } + /// Calls policy class to ask user what to do. virtual SmartAssertBase::UserResponse AskUser() const { return AssertPolicy::AskUser( dynamic_cast< const SmartAssertBase * >( this ) ); } + /// Calls policy class to abort program. virtual void AbortNow() const { AssertPolicy::AbortNow( dynamic_cast< const SmartAssertBase * >( this ) ); @@ -603,9 +654,9 @@ #define LOKI_MAKE_SMART_ASSERT( class_name, ignore_var_name, expr ) \ static bool ignore_var_name = false; \ - class class_name : public ::Loki::SmartAssert< ::Loki::CommandLineAssertPolicy > \ + class class_name : public ::Loki::SmartAssert< ::Loki::CerrAssertPolicy > \ { public: \ - typedef ::Loki::SmartAssert< ::Loki::CommandLineAssertPolicy > BaseClass; \ + typedef ::Loki::SmartAssert< ::Loki::CerrAssertPolicy > BaseClass; \ class_name( bool * ignore, const char * expression ) \ : BaseClass( ignore, expression ) {} \ virtual ~class_name() {} \ @@ -621,7 +672,7 @@ #else #define LOKI_SMART_ASSERT( expr ) \ if ( true ) ; else \ - ::Loki::SmartAssert< ::Loki::CommandLineAssertPolicy >() + ::Loki::SmartAssert< ::Loki::CerrAssertPolicy >() // Do nothing. Compiler should optimize away the else branch. #endif Modified: trunk/src/SmartAssert.cpp =================================================================== --- trunk/src/SmartAssert.cpp 2013-06-24 06:10:50 UTC (rev 1190) +++ trunk/src/SmartAssert.cpp 2013-08-06 22:56:31 UTC (rev 1191) @@ -51,7 +51,7 @@ namespace Loki { -bool SmartAssertBase::s_alwaysIgnore = true; +static bool s_alwaysIgnore = true; const char * const SmartAssertBase::FileDesc = "file"; const char * const SmartAssertBase::LineDesc = "line"; @@ -92,119 +92,121 @@ // --------------------------------------------------------------------- -void AssertInfo::DataValue::Output( DataTypeTag theType ) const +void AssertInfo::DataValue::Output( DataTypeTag theType, bool use_cerr ) const { + ::std::basic_ostream< char > & out = ( use_cerr ) ? ::std::cerr : ::std::cout; + switch ( theType ) { case Unknown: { - cout << "\t Error! Unknown data type! " << theType; + out << "\t Error! Unknown data type! " << theType; break; } case Boolean: { const char * message = m_bool ? "true" : "false"; - cout << message; + out << message; break; } case JustChar: { - cout << m_char; + out << m_char; break; } case SignedChar: { - cout << m_s_char; + out << m_s_char; break; } case UnsignedChar: { - cout << m_u_char; + out << m_u_char; break; } case SignedShort: { - cout << m_s_short; + out << m_s_short; break; } case UnsignedShort: { - cout << m_u_short; + out << m_u_short; break; } case JustInt: { - cout << m_int; + out << m_int; break; } case SignedInt: { - cout << m_int; + out << m_int; break; } case UnsignedInt: { - cout << m_u_int; + out << m_u_int; break; } case Long: { - cout << m_long; + out << m_long; break; } case UnsignedLong: { - cout << m_u_long; + out << m_u_long; break; } case LongInt: { - cout << m_s_long_int; + out << m_s_long_int; break; } case UnsignedLongInt: { - cout << m_u_long_int; + out << m_u_long_int; break; } case CharPtr: { - cout << m_p_char; + out << m_p_char; break; } case SignedCharPtr: { - cout << m_p_s_char; + out << m_p_s_char; break; } case UnsignedCharPtr: { - cout << m_p_u_char; + out << m_p_u_char; break; } case VoidPtr: { - cout << m_p_v; + out << m_p_v; break; } case Float: { - cout << m_float; + out << m_float; break; } case Double: { - cout << m_double; + out << m_double; break; } case LongDouble: { - cout << m_l_double; + out << m_l_double; break; } default: { - cout << "\t Error! Undefined data type! " << theType; + out << "\t Error! Undefined data type! " << theType; break; } } @@ -212,11 +214,12 @@ // --------------------------------------------------------------------- -void AssertInfo::Output() const +void AssertInfo::Output( bool use_cerr ) const { - cout << "\t" << GetName( m_type ) << ": "; - m_value.Output( m_type ); - cout << endl; + ::std::basic_ostream< char > & out = ( use_cerr ) ? ::std::cerr : ::std::cout; + out << "\t" << GetName( m_type ) << ": "; + m_value.Output( m_type, use_cerr ); + out << endl; } // --------------------------------------------------------------------- @@ -241,16 +244,17 @@ // --------------------------------------------------------------------- -void AssertContext::Output() const +void AssertContext::Output( bool use_cerr ) const { - cout << m_description << ": "; + ::std::basic_ostream< char > & out = ( use_cerr ) ? ::std::cerr : ::std::cout; + out << m_description << ": "; if ( m_value != nullptr ) { - cout << m_value; + out << m_value; } else { - cout << m_line; + out << m_line; } } @@ -354,28 +358,14 @@ void SmartAssertBase::CallOutput() const { - CommandLineAssertPolicy::Output( this ); + CerrAssertPolicy::Output( this ); } // --------------------------------------------------------------------- -void SmartAssertBase::CallDebugger() const -{ - CommandLineAssertPolicy::Debugger( this ); -} - -// --------------------------------------------------------------------- - -SmartAssertBase::UserResponse SmartAssertBase::AskUser() const -{ - return CommandLineAssertPolicy::AskUser( this ); -} - -// --------------------------------------------------------------------- - void SmartAssertBase::AbortNow() const { - CommandLineAssertPolicy::AbortNow( this ); + CerrAssertPolicy::AbortNow( this ); } // --------------------------------------------------------------------- @@ -383,15 +373,18 @@ void SmartAssertBase::HandleFailure() { m_handled = true; + if ( FixedProblem() ) + { + return; + } try { + CallOutput(); if ( Info_ == m_level ) { - CallOutput(); return; } - CallOutput(); if ( m_level == Fatal_ ) { AbortNow(); @@ -431,57 +424,42 @@ // --------------------------------------------------------------------- -void CommandLineAssertPolicy::Output( const SmartAssertBase * asserter ) +void CommonOutput( const SmartAssertBase * asserter, bool use_cerr ) { - cout << SmartAssertBase::GetName( asserter->m_level ) - << "! Assertion failed! " << asserter->m_expression << endl; + ::std::basic_ostream< char > & out = ( use_cerr ) ? ::std::cerr : ::std::cout; + out << SmartAssertBase::GetName( asserter->m_level ) + << "! Assertion failed! " << asserter->m_expression << endl; if ( nullptr != asserter->m_context ) { - cout << "\t"; - asserter->m_context->Output(); + out << "\t"; + asserter->m_context->Output( use_cerr ); for ( const AssertContext * p = asserter->m_context->m_next; ( p != nullptr ); p = p->m_next ) { - cout << " "; - p->Output(); + out << " "; + p->Output( use_cerr ); } - cout << endl; + out << endl; } if ( ( nullptr != asserter->m_message ) && ( '\0' != *asserter->m_message ) ) { - cout << "\t" << asserter->m_message << endl; + out << "\t" << asserter->m_message << endl; } for ( const AssertInfo * p = asserter->m_info; ( p != nullptr ); p = p->m_next ) { - p->Output(); + p->Output( use_cerr ); } } // --------------------------------------------------------------------- -void CommandLineAssertPolicy::Debugger( const SmartAssertBase * ) +SmartAssertBase::UserResponse CommonAskUser( const SmartAssertBase * asserter, bool use_cerr ) { -#if defined( _WIN32 ) || defined( __WIN32__ ) || defined( WIN32 ) - ::DebugBreak(); // Win32 + ::std::basic_ostream< char > & output = ( use_cerr ) ? ::std::cerr : ::std::cout; -#elif ( defined _MSC_VER ) || ( defined __BORLANDC__) || ( defined __MWERKS__ ) - __asm { int 3 }; - -#elif defined(__GNUC__) // GCC - __asm ("int $0x3"); - -#else - # error "Please supply instruction to DebugBreak (like 'int 3' on Intel processors)" -#endif -} - -// --------------------------------------------------------------------- - -SmartAssertBase::UserResponse CommandLineAssertPolicy::AskUser( const SmartAssertBase * asserter ) -{ const char * prompt = ( SmartAssertBase::Error_ == asserter->m_level ) ? "\tChoose option: (I)gnore This Time, Ignore (E)ach Time, (D)ebug, (A)bort " : "\tChoose option: (I)gnore This Time, Ignore (E)ach Time, (D)ebug "; - ::std::cout << prompt; + output << prompt; bool keep_asking = true; while ( keep_asking ) @@ -502,7 +480,7 @@ } if ( !isspace( ch ) && keep_asking ) // ignore spaces { - std::cout << prompt; + output << prompt; } } @@ -511,8 +489,48 @@ // --------------------------------------------------------------------- -void CommandLineAssertPolicy::AbortNow( const SmartAssertBase * ) +bool CoutAssertPolicy::FixedProblem( const SmartAssertBase * ) { + return false; +} + +// --------------------------------------------------------------------- + +void CoutAssertPolicy::Output( const SmartAssertBase * asserter ) +{ + CommonOutput( asserter, false ); +} + +// --------------------------------------------------------------------- + +void CoutAssertPolicy::Debugger( const SmartAssertBase * ) +{ +#if defined( _WIN32 ) || defined( __WIN32__ ) || defined( WIN32 ) + ::DebugBreak(); // Win32 + +#elif ( defined _MSC_VER ) || ( defined __BORLANDC__) || ( defined __MWERKS__ ) + __asm { int 3 }; + +#elif defined(__GNUC__) // GCC + __asm ("int $0x3"); + +#else + # error "Please supply instruction to DebugBreak (like 'int 3' on Intel processors)" +#endif +} + +// --------------------------------------------------------------------- + +SmartAssertBase::UserResponse CoutAssertPolicy::AskUser( const SmartAssertBase * asserter ) +{ + const SmartAssertBase::UserResponse reply = CommonAskUser( asserter, false ); + return reply; +} + +// --------------------------------------------------------------------- + +void CoutAssertPolicy::AbortNow( const SmartAssertBase * ) +{ // This might be a good time to call any cleanup services, // and to log any useful information to a file. abort(); @@ -520,6 +538,21 @@ // --------------------------------------------------------------------- +void CerrAssertPolicy::Output( const SmartAssertBase * asserter ) +{ + CommonOutput( asserter, true ); +} + +// --------------------------------------------------------------------- + +SmartAssertBase::UserResponse CerrAssertPolicy::AskUser( const SmartAssertBase * asserter ) +{ + const SmartAssertBase::UserResponse reply = CommonAskUser( asserter, true ); + return reply; +} + +// --------------------------------------------------------------------- + #if defined( _MSC_VER ) #pragma warning( pop ) #endif Modified: trunk/test/SmartAssert/SmartAssert.cbp =================================================================== (Binary files differ) Modified: trunk/test/SmartAssert/main.cpp =================================================================== --- trunk/test/SmartAssert/main.cpp 2013-06-24 06:10:50 UTC (rev 1190) +++ trunk/test/SmartAssert/main.cpp 2013-08-06 22:56:31 UTC (rev 1191) @@ -37,6 +37,9 @@ #include <iostream> +#include <cassert> + + // --------------------------------------------------------------------- class Bogus { }; @@ -138,6 +141,66 @@ // --------------------------------------------------------------------- +/** @class ListAssertInfoOnSameLine + This policy class demonstrates how to write and use your own policies. + It lists assert info descriptions on the same line as their values. It + assumes that if an AssertInfo type is a C-style string, then it must be + a description of the next AssertInfo value. It also puts a blank at the + start of the output to vertically separate the assertion info from any + previous output by the host program. + */ +class ListAssertInfoOnSameLine : public Loki::CerrAssertPolicy +{ +public: + /// Displays information about assertion to the user. + static void Output( const Loki::SmartAssertBase * asserter ); +}; + +// --------------------------------------------------------------------- + +void ListAssertInfoOnSameLine::Output( const ::Loki::SmartAssertBase * asserter ) +{ + assert( nullptr != asserter ); + + ::std::cerr << ::std::endl << ::Loki::SmartAssertBase::GetName( asserter->m_level ) + << "! Assertion failed! " << asserter->m_expression << ::std::endl; + if ( nullptr != asserter->m_context ) + { + ::std::cerr << "\t"; + asserter->m_context->Output( true ); + for ( const ::Loki::AssertContext * p = asserter->m_context->m_next; ( p != nullptr ); p = p->m_next ) + { + ::std::cerr << " "; + p->Output( true ); + } + ::std::cerr << ::std::endl; + } + if ( ( nullptr != asserter->m_message ) && ( '\0' != *asserter->m_message ) ) + { + ::std::cerr << "\t" << asserter->m_message << ::std::endl; + } + + const char * description = nullptr; + for ( const ::Loki::AssertInfo * p = asserter->m_info; ( p != nullptr ); p = p->m_next ) + { + if ( ( ::Loki::AssertInfo::CharPtr == p->m_type ) + && ( p->m_next != nullptr ) ) + { + description = p->m_value.m_p_char; + p = p->m_next; + } + else + { + description = ""; + } + ::std::cerr << "\t" << Loki::AssertInfo::GetName( p->m_type ) << ": " << description << " ("; + p->m_value.Output( p->m_type, true ); + ::std::cerr << ')' << ::std::endl; + } +} + +// --------------------------------------------------------------------- + int main( int argc, const char * argv[] ) { @@ -156,9 +219,24 @@ int a3 = 3; LOKI_SMART_ASSERT( 0 == argc ).Warn()( a1 )( a2 )( a3 )(); - // Show how to put names of variables into assertion info. - LOKI_SMART_ASSERT( 0 == argc ).Warn()( a1 )( "a1" )( a2 )( "a2" )( a3 )( "a3" )(); + const unsigned int counted = 57; + const char * name = "Darth Cuddles"; + const bool result = true; + // Show how to put variables names into assertion info. + LOKI_SMART_ASSERT( 0 == argc ).Warn()( counted )( "counted" )( name )( "name" )( result )( "result" )(); + // Same as before, but this shows how to use a policy to put variable names on the same line as their values. + LOKI_SMART_ASSERT_POLICIED( 0 == argc, ListAssertInfoOnSameLine ).Warn() + ( counted )( "counted" )( name )( "name" )( result )( "result" )(); + + // Same as before, but this shows how to use a policy to put variable descriptions on the same line as their values. + LOKI_SMART_ASSERT_POLICIED( 0 == argc, ListAssertInfoOnSameLine ).Warn() + ( counted )( "death toll" )( name )( "villain" )( result )( "Does evil lose?" )(); + + // Same as before, but this shows how to mix names/descriptions and unnamed variables in the same assertion output. + LOKI_SMART_ASSERT_POLICIED( 0 == argc, ListAssertInfoOnSameLine ).Warn()( a1 ) + ( counted )( "death toll" )( name )( "villain" )( a3 )( result )( "Does evil lose?" )( a2 )(); + test_data_types( argc, argv ); test_ignore( argc ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <syn...@us...> - 2008-12-10 20:22:48
|
Revision: 908 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=908&view=rev Author: syntheticpp Date: 2008-12-10 20:22:40 +0000 (Wed, 10 Dec 2008) Log Message: ----------- add error policy to check return Modified Paths: -------------- trunk/include/loki/CheckReturn.h trunk/test/CheckReturn/main.cpp Modified: trunk/include/loki/CheckReturn.h =================================================================== --- trunk/include/loki/CheckReturn.h 2008-12-10 19:47:33 UTC (rev 907) +++ trunk/include/loki/CheckReturn.h 2008-12-10 20:22:40 UTC (rev 908) @@ -17,7 +17,9 @@ #include <assert.h> +#include <stdio.h> + namespace Loki { @@ -42,7 +44,26 @@ /// can work with other types that have cheap copy operations. //////////////////////////////////////////////////////////////////////////////// -template < class Value > + +struct TriggerAssert +{ + static void run() + { + assert( 0 ); + } +}; + + +struct FprintfStderr +{ + static void run() + { + fprintf(stderr, "CheckReturn: return value was not checked\n"); + } +}; + + +template < class Value , typename OnError = TriggerAssert> class CheckReturn { public: @@ -61,9 +82,10 @@ /// Destructor checks if return value was used. inline ~CheckReturn( void ) { - // If this assertion fails, then a function failed to check the + // If m_checked is false, then a function failed to check the // return value from a function call. - assert( m_checked ); + if (!m_checked) + OnError::run(); } /// Conversion operator changes CheckReturn back to Value type. Modified: trunk/test/CheckReturn/main.cpp =================================================================== --- trunk/test/CheckReturn/main.cpp 2008-12-10 19:47:33 UTC (rev 907) +++ trunk/test/CheckReturn/main.cpp 2008-12-10 20:22:40 UTC (rev 908) @@ -26,7 +26,9 @@ typedef ::Loki::CheckReturn< string > StringReturn; +typedef ::Loki::CheckReturn< bool , ::Loki::FprintfStderr > BoolReturnStderr; + // ---------------------------------------------------------------------------- bool NoCheckRequired( void ) @@ -43,6 +45,14 @@ // ---------------------------------------------------------------------------- +BoolReturnStderr CheckRequiredStderr( void ) +{ + return BoolReturnStderr( true ); +} + + +// ---------------------------------------------------------------------------- + BoolReturn CheckRequired( bool value ) { // By passing false into CheckRequired, CheckRequired calls an overloaded @@ -143,6 +153,11 @@ cout << "Made a nested call to CheckRequired." << endl; } + { + BoolReturnStderr check = CheckRequiredStderr(); + } + cout << "There should be a error message: \nCheckReturn: return value was not checked" << endl; + // This should assert since caller does not check return value. CheckRequired(); cout << "Should assert before this line! How did we get here?" << endl; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <syn...@us...> - 2008-12-10 20:24:19
|
Revision: 909 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=909&view=rev Author: syntheticpp Date: 2008-12-10 20:24:09 +0000 (Wed, 10 Dec 2008) Log Message: ----------- add eol property Modified Paths: -------------- trunk/Loki_MSVC_8.sln trunk/test/SmartPtr/colvin_gibbons_trick.cpp Property Changed: ---------------- trunk/Loki.cbp trunk/Loki.workspace trunk/Loki_MSVC_8.sln trunk/test/SmartPtr/colvin_gibbons_trick.cpp Property changes on: trunk/Loki.cbp ___________________________________________________________________ Added: svn:eol-style + native Property changes on: trunk/Loki.workspace ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/Loki_MSVC_8.sln =================================================================== --- trunk/Loki_MSVC_8.sln 2008-12-10 20:22:40 UTC (rev 908) +++ trunk/Loki_MSVC_8.sln 2008-12-10 20:24:09 UTC (rev 909) @@ -1,152 +1,152 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Library", "src\library_MSVC_8.vcproj", "{CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Factory", "test\Factory\Factory_MSVC_8.vcproj", "{925D5863-2F77-41B7-96F1-CC814762C40F}" - ProjectSection(ProjectDependencies) = postProject - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Longevity", "test\Longevity\Longevity_MSVC_8.vcproj", "{1333D945-B228-4845-9C91-C1B67AEEAED5}" - ProjectSection(ProjectDependencies) = postProject - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OrderedStatic", "test\OrderedStatic\OrderedStatic_MSVC_8.vcproj", "{0DCBE03A-DAC7-4669-B29B-102D8F563736}" - ProjectSection(ProjectDependencies) = postProject - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SafeFormat", "test\SafeFormat\SafeFormat_MSVC_8.vcproj", "{C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ScopeGuard", "test\ScopeGuard\ScopeGuard_MSVC_8.vcproj", "{D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Singleton", "test\Singleton\Singleton_MSVC_8.vcproj", "{9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}" - ProjectSection(ProjectDependencies) = postProject - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Visitor", "test\Visitor\Visitor_MSVC_8.vcproj", "{0A696379-10A2-43FB-A26C-B42456FCF657}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flex_string", "test\flex_string\flex_string_MSVC_8.vcproj", "{2022B9AD-34CA-4FDA-80C2-42805FABE65B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmallObjCompare", "test\SmallObj\SmallObjCompare_MSVC_8.vcproj", "{0A98B714-818C-4DD3-A07C-BDD16399F362}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmallObjSingleton", "test\SmallObj\SmallObjSingleton_MSVC_8.vcproj", "{78536B46-8307-4AE5-933E-0CADE2887AFB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DeletableSingleton", "test\DeletableSingleton\DeletableSingleton_MSVC_8.vcproj", "{B87B3522-7DAA-400D-A47D-A74B9B8B3552}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DefaultAlloc", "test\SmallObj\DefaultAlloc_MSVC_8.vcproj", "{D490B134-B794-42CF-8AF8-9FDA524B9D3B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmartPtr", "test\SmartPtr\SmartPtr_MSVC_8.vcproj", "{D7AB4FEF-E7AF-443D-93A5-37F323F2042D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSVCUnitTest", "test\RegressionTest\MSVCUnitTest_MSVC_8.vcproj", "{79729949-F144-4098-BFE9-B6320E6AC3F6}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Pimpl", "test\Pimpl\Pimpl_MSVC_8.vcproj", "{21D2B291-80F4-476C-A643-B8A7034DF95F}" - ProjectSection(ProjectDependencies) = postProject - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LockingPtr", "test\LockingPtr\LockingPtr_MSVC_8.vcproj", "{25766C3F-C0D8-429F-A212-5FA3537B3E1C}" - ProjectSection(ProjectDependencies) = postProject - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Function", "test\Function\Function_MSVC_8.vcproj", "{2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CachedFactory", "test\CachedFactory\CachedFactory_MSVC_8.vcproj", "{8D186AB4-E544-42D6-B192-1AE2C946875E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CheckReturn", "test\CheckReturn\CheckReturn_MSVC_8.vcproj", "{C0826A05-9143-4545-B5DE-811C188CB54E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Debug|Win32.ActiveCfg = Debug|Win32 - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Debug|Win32.Build.0 = Debug|Win32 - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release|Win32.ActiveCfg = Release|Win32 - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release|Win32.Build.0 = Release|Win32 - {925D5863-2F77-41B7-96F1-CC814762C40F}.Debug|Win32.ActiveCfg = Debug|Win32 - {925D5863-2F77-41B7-96F1-CC814762C40F}.Debug|Win32.Build.0 = Debug|Win32 - {925D5863-2F77-41B7-96F1-CC814762C40F}.Release|Win32.ActiveCfg = Release|Win32 - {925D5863-2F77-41B7-96F1-CC814762C40F}.Release|Win32.Build.0 = Release|Win32 - {1333D945-B228-4845-9C91-C1B67AEEAED5}.Debug|Win32.ActiveCfg = Debug|Win32 - {1333D945-B228-4845-9C91-C1B67AEEAED5}.Debug|Win32.Build.0 = Debug|Win32 - {1333D945-B228-4845-9C91-C1B67AEEAED5}.Release|Win32.ActiveCfg = Release|Win32 - {1333D945-B228-4845-9C91-C1B67AEEAED5}.Release|Win32.Build.0 = Release|Win32 - {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Debug|Win32.ActiveCfg = Debug|Win32 - {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Debug|Win32.Build.0 = Debug|Win32 - {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Release|Win32.ActiveCfg = Release|Win32 - {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Release|Win32.Build.0 = Release|Win32 - {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Debug|Win32.ActiveCfg = Debug|Win32 - {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Debug|Win32.Build.0 = Debug|Win32 - {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Release|Win32.ActiveCfg = Release|Win32 - {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Release|Win32.Build.0 = Release|Win32 - {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Debug|Win32.ActiveCfg = Debug|Win32 - {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Debug|Win32.Build.0 = Debug|Win32 - {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Release|Win32.ActiveCfg = Release|Win32 - {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Release|Win32.Build.0 = Release|Win32 - {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Debug|Win32.ActiveCfg = Debug|Win32 - {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Debug|Win32.Build.0 = Debug|Win32 - {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Release|Win32.ActiveCfg = Release|Win32 - {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Release|Win32.Build.0 = Release|Win32 - {0A696379-10A2-43FB-A26C-B42456FCF657}.Debug|Win32.ActiveCfg = Debug|Win32 - {0A696379-10A2-43FB-A26C-B42456FCF657}.Debug|Win32.Build.0 = Debug|Win32 - {0A696379-10A2-43FB-A26C-B42456FCF657}.Release|Win32.ActiveCfg = Release|Win32 - {0A696379-10A2-43FB-A26C-B42456FCF657}.Release|Win32.Build.0 = Release|Win32 - {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Debug|Win32.ActiveCfg = Debug|Win32 - {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Debug|Win32.Build.0 = Debug|Win32 - {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Release|Win32.ActiveCfg = Release|Win32 - {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Release|Win32.Build.0 = Release|Win32 - {0A98B714-818C-4DD3-A07C-BDD16399F362}.Debug|Win32.ActiveCfg = Debug|Win32 - {0A98B714-818C-4DD3-A07C-BDD16399F362}.Debug|Win32.Build.0 = Debug|Win32 - {0A98B714-818C-4DD3-A07C-BDD16399F362}.Release|Win32.ActiveCfg = Release|Win32 - {0A98B714-818C-4DD3-A07C-BDD16399F362}.Release|Win32.Build.0 = Release|Win32 - {78536B46-8307-4AE5-933E-0CADE2887AFB}.Debug|Win32.ActiveCfg = Debug|Win32 - {78536B46-8307-4AE5-933E-0CADE2887AFB}.Debug|Win32.Build.0 = Debug|Win32 - {78536B46-8307-4AE5-933E-0CADE2887AFB}.Release|Win32.ActiveCfg = Release|Win32 - {78536B46-8307-4AE5-933E-0CADE2887AFB}.Release|Win32.Build.0 = Release|Win32 - {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Debug|Win32.ActiveCfg = Debug|Win32 - {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Debug|Win32.Build.0 = Debug|Win32 - {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Release|Win32.ActiveCfg = Release|Win32 - {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Release|Win32.Build.0 = Release|Win32 - {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Debug|Win32.ActiveCfg = Debug|Win32 - {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Debug|Win32.Bild.0 = Debug|Win32 - {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Release|Win32.ActiveCfg = Release|Win32 - {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Release|Win32.Build.0 = Release|Win32 - {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Debug|Win32.ActiveCfg = Debug|Win32 - {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Debug|Win32.Build.0 = Debug|Win32 - {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Release|Win32.ActiveCfg = Release|Win32 - {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Release|Win32.Build.0 = Release|Win32 - {79729949-F144-4098-BFE9-B6320E6AC3F6}.Debug|Win32.ActiveCfg = Debug|Win32 - {79729949-F144-4098-BFE9-B6320E6AC3F6}.Debug|Win32.Build.0 = Debug|Win32 - {79729949-F144-4098-BFE9-B6320E6AC3F6}.Release|Win32.ActiveCfg = Release|Win32 - {79729949-F144-4098-BFE9-B6320E6AC3F6}.Release|Win32.Build.0 = Release|Win32 - {21D2B291-80F4-476C-A643-B8A7034DF95F}.Debug|Win32.ActiveCfg = Debug|Win32 - {21D2B291-80F4-476C-A643-B8A7034DF95F}.Debug|Win32.Build.0 = Debug|Win32 - {21D2B291-80F4-476C-A643-B8A7034DF95F}.Release|Win32.ActiveCfg = Release|Win32 - {21D2B291-80F4-476C-A643-B8A7034DF95F}.Release|Win32.Build.0 = Release|Win32 - {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Debug|Win32.ActiveCfg = Debug|Win32 - {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Debug|Win32.Build.0 = Debug|Win32 - {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Release|Win32.ActiveCfg = Release|Win32 - {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Release|Win32.Build.0 = Release|Win32 - {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Debug|Win32.ActiveCfg = Debug|Win32 - {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Debug|Win32.Build.0 = Debug|Win32 - {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Release|Win32.ActiveCfg = Release|Win32 - {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Release|Win32.Build.0 = Release|Win32 - {8D186AB4-E544-42D6-B192-1AE2C946875E}.Debug|Win32.ActiveCfg = Debug|Win32 - {8D186AB4-E544-42D6-B192-1AE2C946875E}.Debug|Win32.Build.0 = Debug|Win32 - {8D186AB4-E544-42D6-B192-1AE2C946875E}.Release|Win32.ActiveCfg = Release|Win32 - {8D186AB4-E544-42D6-B192-1AE2C946875E}.Release|Win32.Build.0 = Release|Win32 - {C0826A05-9143-4545-B5DE-811C188CB54E}.Debug|Win32.ActiveCfg = Debug|Win32 - {C0826A05-9143-4545-B5DE-811C188CB54E}.Debug|Win32.Build.0 = Debug|Win32 - {C0826A05-9143-4545-B5DE-811C188CB54E}.Release|Win32.ActiveCfg = Release|Win32 - {C0826A05-9143-4545-B5DE-811C188CB54E}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Library", "src\library_MSVC_8.vcproj", "{CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Factory", "test\Factory\Factory_MSVC_8.vcproj", "{925D5863-2F77-41B7-96F1-CC814762C40F}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Longevity", "test\Longevity\Longevity_MSVC_8.vcproj", "{1333D945-B228-4845-9C91-C1B67AEEAED5}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OrderedStatic", "test\OrderedStatic\OrderedStatic_MSVC_8.vcproj", "{0DCBE03A-DAC7-4669-B29B-102D8F563736}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SafeFormat", "test\SafeFormat\SafeFormat_MSVC_8.vcproj", "{C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ScopeGuard", "test\ScopeGuard\ScopeGuard_MSVC_8.vcproj", "{D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Singleton", "test\Singleton\Singleton_MSVC_8.vcproj", "{9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Visitor", "test\Visitor\Visitor_MSVC_8.vcproj", "{0A696379-10A2-43FB-A26C-B42456FCF657}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flex_string", "test\flex_string\flex_string_MSVC_8.vcproj", "{2022B9AD-34CA-4FDA-80C2-42805FABE65B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmallObjCompare", "test\SmallObj\SmallObjCompare_MSVC_8.vcproj", "{0A98B714-818C-4DD3-A07C-BDD16399F362}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmallObjSingleton", "test\SmallObj\SmallObjSingleton_MSVC_8.vcproj", "{78536B46-8307-4AE5-933E-0CADE2887AFB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DeletableSingleton", "test\DeletableSingleton\DeletableSingleton_MSVC_8.vcproj", "{B87B3522-7DAA-400D-A47D-A74B9B8B3552}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DefaultAlloc", "test\SmallObj\DefaultAlloc_MSVC_8.vcproj", "{D490B134-B794-42CF-8AF8-9FDA524B9D3B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmartPtr", "test\SmartPtr\SmartPtr_MSVC_8.vcproj", "{D7AB4FEF-E7AF-443D-93A5-37F323F2042D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSVCUnitTest", "test\RegressionTest\MSVCUnitTest_MSVC_8.vcproj", "{79729949-F144-4098-BFE9-B6320E6AC3F6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Pimpl", "test\Pimpl\Pimpl_MSVC_8.vcproj", "{21D2B291-80F4-476C-A643-B8A7034DF95F}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LockingPtr", "test\LockingPtr\LockingPtr_MSVC_8.vcproj", "{25766C3F-C0D8-429F-A212-5FA3537B3E1C}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Function", "test\Function\Function_MSVC_8.vcproj", "{2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CachedFactory", "test\CachedFactory\CachedFactory_MSVC_8.vcproj", "{8D186AB4-E544-42D6-B192-1AE2C946875E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CheckReturn", "test\CheckReturn\CheckReturn_MSVC_8.vcproj", "{C0826A05-9143-4545-B5DE-811C188CB54E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Debug|Win32.ActiveCfg = Debug|Win32 + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Debug|Win32.Build.0 = Debug|Win32 + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release|Win32.ActiveCfg = Release|Win32 + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release|Win32.Build.0 = Release|Win32 + {925D5863-2F77-41B7-96F1-CC814762C40F}.Debug|Win32.ActiveCfg = Debug|Win32 + {925D5863-2F77-41B7-96F1-CC814762C40F}.Debug|Win32.Build.0 = Debug|Win32 + {925D5863-2F77-41B7-96F1-CC814762C40F}.Release|Win32.ActiveCfg = Release|Win32 + {925D5863-2F77-41B7-96F1-CC814762C40F}.Release|Win32.Build.0 = Release|Win32 + {1333D945-B228-4845-9C91-C1B67AEEAED5}.Debug|Win32.ActiveCfg = Debug|Win32 + {1333D945-B228-4845-9C91-C1B67AEEAED5}.Debug|Win32.Build.0 = Debug|Win32 + {1333D945-B228-4845-9C91-C1B67AEEAED5}.Release|Win32.ActiveCfg = Release|Win32 + {1333D945-B228-4845-9C91-C1B67AEEAED5}.Release|Win32.Build.0 = Release|Win32 + {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Debug|Win32.ActiveCfg = Debug|Win32 + {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Debug|Win32.Build.0 = Debug|Win32 + {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Release|Win32.ActiveCfg = Release|Win32 + {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Release|Win32.Build.0 = Release|Win32 + {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Debug|Win32.ActiveCfg = Debug|Win32 + {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Debug|Win32.Build.0 = Debug|Win32 + {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Release|Win32.ActiveCfg = Release|Win32 + {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Release|Win32.Build.0 = Release|Win32 + {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Debug|Win32.ActiveCfg = Debug|Win32 + {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Debug|Win32.Build.0 = Debug|Win32 + {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Release|Win32.ActiveCfg = Release|Win32 + {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Release|Win32.Build.0 = Release|Win32 + {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Debug|Win32.ActiveCfg = Debug|Win32 + {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Debug|Win32.Build.0 = Debug|Win32 + {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Release|Win32.ActiveCfg = Release|Win32 + {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Release|Win32.Build.0 = Release|Win32 + {0A696379-10A2-43FB-A26C-B42456FCF657}.Debug|Win32.ActiveCfg = Debug|Win32 + {0A696379-10A2-43FB-A26C-B42456FCF657}.Debug|Win32.Build.0 = Debug|Win32 + {0A696379-10A2-43FB-A26C-B42456FCF657}.Release|Win32.ActiveCfg = Release|Win32 + {0A696379-10A2-43FB-A26C-B42456FCF657}.Release|Win32.Build.0 = Release|Win32 + {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Debug|Win32.ActiveCfg = Debug|Win32 + {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Debug|Win32.Build.0 = Debug|Win32 + {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Release|Win32.ActiveCfg = Release|Win32 + {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Release|Win32.Build.0 = Release|Win32 + {0A98B714-818C-4DD3-A07C-BDD16399F362}.Debug|Win32.ActiveCfg = Debug|Win32 + {0A98B714-818C-4DD3-A07C-BDD16399F362}.Debug|Win32.Build.0 = Debug|Win32 + {0A98B714-818C-4DD3-A07C-BDD16399F362}.Release|Win32.ActiveCfg = Release|Win32 + {0A98B714-818C-4DD3-A07C-BDD16399F362}.Release|Win32.Build.0 = Release|Win32 + {78536B46-8307-4AE5-933E-0CADE2887AFB}.Debug|Win32.ActiveCfg = Debug|Win32 + {78536B46-8307-4AE5-933E-0CADE2887AFB}.Debug|Win32.Build.0 = Debug|Win32 + {78536B46-8307-4AE5-933E-0CADE2887AFB}.Release|Win32.ActiveCfg = Release|Win32 + {78536B46-8307-4AE5-933E-0CADE2887AFB}.Release|Win32.Build.0 = Release|Win32 + {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Debug|Win32.ActiveCfg = Debug|Win32 + {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Debug|Win32.Build.0 = Debug|Win32 + {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Release|Win32.ActiveCfg = Release|Win32 + {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Release|Win32.Build.0 = Release|Win32 + {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Debug|Win32.ActiveCfg = Debug|Win32 + {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Debug|Win32.Bild.0 = Debug|Win32 + {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Release|Win32.ActiveCfg = Release|Win32 + {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Release|Win32.Build.0 = Release|Win32 + {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Debug|Win32.ActiveCfg = Debug|Win32 + {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Debug|Win32.Build.0 = Debug|Win32 + {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Release|Win32.ActiveCfg = Release|Win32 + {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Release|Win32.Build.0 = Release|Win32 + {79729949-F144-4098-BFE9-B6320E6AC3F6}.Debug|Win32.ActiveCfg = Debug|Win32 + {79729949-F144-4098-BFE9-B6320E6AC3F6}.Debug|Win32.Build.0 = Debug|Win32 + {79729949-F144-4098-BFE9-B6320E6AC3F6}.Release|Win32.ActiveCfg = Release|Win32 + {79729949-F144-4098-BFE9-B6320E6AC3F6}.Release|Win32.Build.0 = Release|Win32 + {21D2B291-80F4-476C-A643-B8A7034DF95F}.Debug|Win32.ActiveCfg = Debug|Win32 + {21D2B291-80F4-476C-A643-B8A7034DF95F}.Debug|Win32.Build.0 = Debug|Win32 + {21D2B291-80F4-476C-A643-B8A7034DF95F}.Release|Win32.ActiveCfg = Release|Win32 + {21D2B291-80F4-476C-A643-B8A7034DF95F}.Release|Win32.Build.0 = Release|Win32 + {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Debug|Win32.ActiveCfg = Debug|Win32 + {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Debug|Win32.Build.0 = Debug|Win32 + {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Release|Win32.ActiveCfg = Release|Win32 + {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Release|Win32.Build.0 = Release|Win32 + {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Debug|Win32.ActiveCfg = Debug|Win32 + {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Debug|Win32.Build.0 = Debug|Win32 + {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Release|Win32.ActiveCfg = Release|Win32 + {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Release|Win32.Build.0 = Release|Win32 + {8D186AB4-E544-42D6-B192-1AE2C946875E}.Debug|Win32.ActiveCfg = Debug|Win32 + {8D186AB4-E544-42D6-B192-1AE2C946875E}.Debug|Win32.Build.0 = Debug|Win32 + {8D186AB4-E544-42D6-B192-1AE2C946875E}.Release|Win32.ActiveCfg = Release|Win32 + {8D186AB4-E544-42D6-B192-1AE2C946875E}.Release|Win32.Build.0 = Release|Win32 + {C0826A05-9143-4545-B5DE-811C188CB54E}.Debug|Win32.ActiveCfg = Debug|Win32 + {C0826A05-9143-4545-B5DE-811C188CB54E}.Debug|Win32.Build.0 = Debug|Win32 + {C0826A05-9143-4545-B5DE-811C188CB54E}.Release|Win32.ActiveCfg = Release|Win32 + {C0826A05-9143-4545-B5DE-811C188CB54E}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Property changes on: trunk/Loki_MSVC_8.sln ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/test/SmartPtr/colvin_gibbons_trick.cpp =================================================================== --- trunk/test/SmartPtr/colvin_gibbons_trick.cpp 2008-12-10 20:22:40 UTC (rev 908) +++ trunk/test/SmartPtr/colvin_gibbons_trick.cpp 2008-12-10 20:24:09 UTC (rev 909) @@ -1,121 +1,121 @@ -//////////////////////////////////////////////////////////////////////////////// -// Test program for The Loki Library -// Copyright (c) 2008 Richard Sposato -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this -// permission notice appear in supporting documentation. -// The authors make no representations about the -// suitability of this software for any purpose. It is provided "as is" -// without express or implied warranty. -//////////////////////////////////////////////////////////////////////////////// - -// $Id$ - - -// ---------------------------------------------------------------------------- - - -// loki_smart_auto_ptr.cpp Test program for Loki::SmartPtr configured as -// auto_ptr using Colvin-Gibbons trick - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <loki/SmartPtr.h> - -#include <memory> -#include <iostream> -#include <cstdlib> - - -using namespace Loki; -using namespace std; - - -// ---------------------------------------------------------------------------- - -class Base -{ -public: - virtual ~Base() {} - - virtual void Hello() { cout << "Base Hello, world!" << endl; } -}; - -// ---------------------------------------------------------------------------- - -class Derived: public Base -{ -public: - virtual void Hello() { cout << "Derived Hello, world!" << endl; } -}; - - -// ---------------------------------------------------------------------------- - -typedef auto_ptr< Base > AutoPtrBase; -typedef auto_ptr< Derived > AutoPtrDerived; - -typedef SmartPtr< Base, DestructiveCopy > SmartAutoPtrBase; -typedef SmartPtr< Derived, DestructiveCopy > SmartAutoPtrDerived; - - -// ---------------------------------------------------------------------------- - -template <class TPtrBase> -TPtrBase CreateBase() -{ - return TPtrBase( new Base ); -} - -// ---------------------------------------------------------------------------- - -template <class TPtrDerived> -TPtrDerived CreateDerived() -{ - return TPtrDerived( new Derived ); -} - -// ---------------------------------------------------------------------------- - -template < class TPtrBase > -void UseBase( TPtrBase ptr ) -{ - ptr->Hello(); -} - -// ---------------------------------------------------------------------------- - -template < class TPtrBase, class TPtrDerived > -void DoTest() -{ - TPtrBase spb0 = CreateBase< TPtrBase >(); - TPtrBase spb1( spb0 ); - - UseBase< TPtrBase >( CreateBase< TPtrBase >() ); - - TPtrDerived spd1 = CreateDerived< TPtrDerived >(); - TPtrBase spb2( spd1 ); - - // NOTE: this does not compile with gcc 4.3.1 also for std::auto_ptr; - // it should work (Copy-initialization, base-from-derived) - // according to http://www.open-std.org/jtc1/sc22/wg21/docs/papers/1997/N1128.pdf - // It does compile with Visual C++ 8 (need to test with 9) - // UseBase<TPtrBase>(CreateDerived<TPtrDerived>()); - - // Quick fix - UseBase< TPtrBase >( TPtrBase( CreateDerived< TPtrDerived >() ) ); -} - -// ---------------------------------------------------------------------------- - -void TryColvinGibbonsTrick( void ) -{ - DoTest<AutoPtrBase, AutoPtrDerived>(); // OK - DoTest<SmartAutoPtrBase, SmartAutoPtrDerived>(); // FIXME: eror: - // assignment of read-only reference 'val' -} - -// ---------------------------------------------------------------------------- +//////////////////////////////////////////////////////////////////////////////// +// Test program for The Loki Library +// Copyright (c) 2008 Richard Sposato +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this +// permission notice appear in supporting documentation. +// The authors make no representations about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. +//////////////////////////////////////////////////////////////////////////////// + +// $Id$ + + +// ---------------------------------------------------------------------------- + + +// loki_smart_auto_ptr.cpp Test program for Loki::SmartPtr configured as +// auto_ptr using Colvin-Gibbons trick + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <loki/SmartPtr.h> + +#include <memory> +#include <iostream> +#include <cstdlib> + + +using namespace Loki; +using namespace std; + + +// ---------------------------------------------------------------------------- + +class Base +{ +public: + virtual ~Base() {} + + virtual void Hello() { cout << "Base Hello, world!" << endl; } +}; + +// ---------------------------------------------------------------------------- + +class Derived: public Base +{ +public: + virtual void Hello() { cout << "Derived Hello, world!" << endl; } +}; + + +// ---------------------------------------------------------------------------- + +typedef auto_ptr< Base > AutoPtrBase; +typedef auto_ptr< Derived > AutoPtrDerived; + +typedef SmartPtr< Base, DestructiveCopy > SmartAutoPtrBase; +typedef SmartPtr< Derived, DestructiveCopy > SmartAutoPtrDerived; + + +// ---------------------------------------------------------------------------- + +template <class TPtrBase> +TPtrBase CreateBase() +{ + return TPtrBase( new Base ); +} + +// ---------------------------------------------------------------------------- + +template <class TPtrDerived> +TPtrDerived CreateDerived() +{ + return TPtrDerived( new Derived ); +} + +// ---------------------------------------------------------------------------- + +template < class TPtrBase > +void UseBase( TPtrBase ptr ) +{ + ptr->Hello(); +} + +// ---------------------------------------------------------------------------- + +template < class TPtrBase, class TPtrDerived > +void DoTest() +{ + TPtrBase spb0 = CreateBase< TPtrBase >(); + TPtrBase spb1( spb0 ); + + UseBase< TPtrBase >( CreateBase< TPtrBase >() ); + + TPtrDerived spd1 = CreateDerived< TPtrDerived >(); + TPtrBase spb2( spd1 ); + + // NOTE: this does not compile with gcc 4.3.1 also for std::auto_ptr; + // it should work (Copy-initialization, base-from-derived) + // according to http://www.open-std.org/jtc1/sc22/wg21/docs/papers/1997/N1128.pdf + // It does compile with Visual C++ 8 (need to test with 9) + // UseBase<TPtrBase>(CreateDerived<TPtrDerived>()); + + // Quick fix + UseBase< TPtrBase >( TPtrBase( CreateDerived< TPtrDerived >() ) ); +} + +// ---------------------------------------------------------------------------- + +void TryColvinGibbonsTrick( void ) +{ + DoTest<AutoPtrBase, AutoPtrDerived>(); // OK + DoTest<SmartAutoPtrBase, SmartAutoPtrDerived>(); // FIXME: eror: + // assignment of read-only reference 'val' +} + +// ---------------------------------------------------------------------------- Property changes on: trunk/test/SmartPtr/colvin_gibbons_trick.cpp ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <syn...@us...> - 2009-01-26 19:46:00
|
Revision: 950 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=950&view=rev Author: syntheticpp Date: 2009-01-26 19:45:54 +0000 (Mon, 26 Jan 2009) Log Message: ----------- Cygwin fixes: build with mingw 3.4.4 and 4.3.2 Modified Paths: -------------- trunk/include/loki/CachedFactory.h trunk/src/LevelMutex.cpp trunk/src/Makefile Modified: trunk/include/loki/CachedFactory.h =================================================================== --- trunk/include/loki/CachedFactory.h 2009-01-26 02:04:40 UTC (rev 949) +++ trunk/include/loki/CachedFactory.h 2009-01-26 19:45:54 UTC (rev 950) @@ -37,7 +37,7 @@ #define D( x ) ; #endif -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__CYGWIN__) #include <time.h> #endif Modified: trunk/src/LevelMutex.cpp =================================================================== --- trunk/src/LevelMutex.cpp 2009-01-26 02:04:40 UTC (rev 949) +++ trunk/src/LevelMutex.cpp 2009-01-26 19:45:54 UTC (rev 950) @@ -20,6 +20,8 @@ // ---------------------------------------------------------------------------- +#if !defined(__CYGWIN__) || (defined(__CYGWIN__) && __GNUC__ > 3) + #include <loki/LevelMutex.h> #include <algorithm> @@ -1148,3 +1150,7 @@ // ---------------------------------------------------------------------------- } // end namespace Loki + + +#endif + Modified: trunk/src/Makefile =================================================================== --- trunk/src/Makefile 2009-01-26 02:04:40 UTC (rev 949) +++ trunk/src/Makefile 2009-01-26 19:45:54 UTC (rev 950) @@ -31,6 +31,7 @@ SHARED_LIB_VERSIONED := libloki.so.$(VERSION) override LDFLAGS += --shared -Wl,-soname=$(SHARED_LIB_VERSIONED) -fPIC LDLIBS := -lpthread +else ifeq ($(OS), HP-UX) SHARED_LIB_BASE := libloki.so SHARED_LIB_VERSIONED := libloki.so.$(VERSION) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <syn...@us...> - 2009-01-29 17:39:05
|
Revision: 958 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=958&view=rev Author: syntheticpp Date: 2009-01-29 17:38:55 +0000 (Thu, 29 Jan 2009) Log Message: ----------- fix line endings Modified Paths: -------------- trunk/Loki_MSVC_9.sln trunk/src/Library_MSVC9.vcproj trunk/test/CachedFactory/CachedFactory_MSVC9.vcproj trunk/test/CheckReturn/CheckReturn_MSVC9.vcproj trunk/test/Checker/Checker.vcproj trunk/test/DeletableSingleton/DeletableSingleton_MSVC9.vcproj trunk/test/Factory/Factory_MSVC9.vcproj trunk/test/Function/Function_MSVC9.vcproj trunk/test/LevelMutex/LevelMutex.vcproj trunk/test/LockingPtr/LockingPtr_MSVC9.vcproj trunk/test/Longevity/Longevity_MSVC9.vcproj trunk/test/OrderedStatic/OrderedStatic_MSVC9.vcproj trunk/test/Pimpl/Pimpl_MSVC9.vcproj trunk/test/RegressionTest/MSVCUnitTest_MSVC9.vcproj trunk/test/SafeBits/SafeBits.vcproj trunk/test/SafeBits/SafeBits_MSVC_9.vcproj trunk/test/SafeFormat/SafeFormat_MSVC9.vcproj trunk/test/ScopeGuard/ScopeGuard_MSVC9.vcproj trunk/test/Singleton/Singleton_MSVC9.vcproj trunk/test/SingletonDll/Client_MSVC9.vcproj trunk/test/SingletonDll/SingletonDll_MSVC9.sln trunk/test/SingletonDll/SingletonDll_MSVC9.vcproj trunk/test/SingletonDll/foo_MSVC9.vcproj trunk/test/SmallObj/DefaultAlloc_MSVC9.vcproj trunk/test/SmallObj/SmallObjCompare_MSVC9.vcproj trunk/test/SmallObj/SmallObjSingleton_MSVC9.vcproj trunk/test/SmartPtr/SmartPtr_MSVC9.vcproj trunk/test/Visitor/Visitor_MSVC9.vcproj trunk/test/flex_string/flex_string_MSVC9.vcproj Property Changed: ---------------- trunk/Loki_MSVC_9.sln trunk/src/Library_MSVC9.vcproj trunk/test/CachedFactory/CachedFactory_MSVC9.vcproj trunk/test/CheckReturn/CheckReturn_MSVC9.vcproj trunk/test/Checker/Checker.vcproj trunk/test/DeletableSingleton/DeletableSingleton_MSVC9.vcproj trunk/test/Factory/Factory_MSVC9.vcproj trunk/test/Function/Function_MSVC9.vcproj trunk/test/LevelMutex/LevelMutex.vcproj trunk/test/LockingPtr/LockingPtr_MSVC9.vcproj trunk/test/Longevity/Longevity_MSVC9.vcproj trunk/test/OrderedStatic/OrderedStatic_MSVC9.vcproj trunk/test/Pimpl/Pimpl_MSVC9.vcproj trunk/test/RegressionTest/MSVCUnitTest_MSVC9.vcproj trunk/test/SafeBits/SafeBits.cbp trunk/test/SafeBits/SafeBits.vcproj trunk/test/SafeBits/SafeBits_MSVC_9.vcproj trunk/test/SafeFormat/SafeFormat_MSVC9.vcproj trunk/test/ScopeGuard/ScopeGuard_MSVC9.vcproj trunk/test/Singleton/Singleton_MSVC9.vcproj trunk/test/SingletonDll/Client_MSVC9.vcproj trunk/test/SingletonDll/SingletonDll_MSVC9.sln trunk/test/SingletonDll/SingletonDll_MSVC9.vcproj trunk/test/SingletonDll/foo_MSVC9.vcproj trunk/test/SmallObj/DefaultAlloc_MSVC9.vcproj trunk/test/SmallObj/SmallObjCompare_MSVC9.vcproj trunk/test/SmallObj/SmallObjSingleton_MSVC9.vcproj trunk/test/SmartPtr/SmartPtr_MSVC9.vcproj trunk/test/Visitor/Visitor_MSVC9.vcproj trunk/test/flex_string/flex_string_MSVC9.vcproj Modified: trunk/Loki_MSVC_9.sln =================================================================== --- trunk/Loki_MSVC_9.sln 2009-01-29 08:30:08 UTC (rev 957) +++ trunk/Loki_MSVC_9.sln 2009-01-29 17:38:55 UTC (rev 958) @@ -1,219 +1,219 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Library", "src\library_MSVC9.vcproj", "{CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Factory", "test\Factory\Factory_MSVC9.vcproj", "{925D5863-2F77-41B7-96F1-CC814762C40F}" - ProjectSection(ProjectDependencies) = postProject - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Longevity", "test\Longevity\Longevity_MSVC9.vcproj", "{1333D945-B228-4845-9C91-C1B67AEEAED5}" - ProjectSection(ProjectDependencies) = postProject - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OrderedStatic", "test\OrderedStatic\OrderedStatic_MSVC9.vcproj", "{0DCBE03A-DAC7-4669-B29B-102D8F563736}" - ProjectSection(ProjectDependencies) = postProject - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SafeFormat", "test\SafeFormat\SafeFormat_MSVC9.vcproj", "{C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ScopeGuard", "test\ScopeGuard\ScopeGuard_MSVC9.vcproj", "{D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Singleton", "test\Singleton\Singleton_MSVC9.vcproj", "{9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}" - ProjectSection(ProjectDependencies) = postProject - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Visitor", "test\Visitor\Visitor_MSVC9.vcproj", "{0A696379-10A2-43FB-A26C-B42456FCF657}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flex_string", "test\flex_string\flex_string_MSVC9.vcproj", "{2022B9AD-34CA-4FDA-80C2-42805FABE65B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmallObjCompare", "test\SmallObj\SmallObjCompare_MSVC9.vcproj", "{0A98B714-818C-4DD3-A07C-BDD16399F362}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmallObjSingleton", "test\SmallObj\SmallObjSingleton_MSVC9.vcproj", "{78536B46-8307-4AE5-933E-0CADE2887AFB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DeletableSingleton", "test\DeletableSingleton\DeletableSingleton_MSVC9.vcproj", "{B87B3522-7DAA-400D-A47D-A74B9B8B3552}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DefaultAlloc", "test\SmallObj\DefaultAlloc_MSVC9.vcproj", "{D490B134-B794-42CF-8AF8-9FDA524B9D3B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmartPtr", "test\SmartPtr\SmartPtr_MSVC9.vcproj", "{D7AB4FEF-E7AF-443D-93A5-37F323F2042D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSVCUnitTest", "test\RegressionTest\MSVCUnitTest_MSVC9.vcproj", "{79729949-F144-4098-BFE9-B6320E6AC3F6}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Pimpl", "test\Pimpl\Pimpl_MSVC9.vcproj", "{21D2B291-80F4-476C-A643-B8A7034DF95F}" - ProjectSection(ProjectDependencies) = postProject - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LockingPtr", "test\LockingPtr\LockingPtr_MSVC9.vcproj", "{25766C3F-C0D8-429F-A212-5FA3537B3E1C}" - ProjectSection(ProjectDependencies) = postProject - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Function", "test\Function\Function_MSVC9.vcproj", "{2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CachedFactory", "test\CachedFactory\CachedFactory_MSVC9.vcproj", "{8D186AB4-E544-42D6-B192-1AE2C946875E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CheckReturn", "test\CheckReturn\CheckReturn_MSVC9.vcproj", "{C0826A05-9143-4545-B5DE-811C188CB54E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Checker", "test\Checker\Checker_MSVC_9.vcproj", "{2148AAC5-5CE3-493E-8D82-439ABC2E8053}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LevelMutex", "test\LevelMutex\LevelMutex_MSVC_9.vcproj", "{7C09E027-5484-4641-8310-BDDEB1EC8676}" - ProjectSection(ProjectDependencies) = postProject - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SafeBits", "test\SafeBits\SafeBits_MSVC_9.vcproj", "{ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release_MultiThreaded|Win32 = Release_MultiThreaded|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Debug|Win32.ActiveCfg = Debug|Win32 - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Debug|Win32.Build.0 = Debug|Win32 - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release|Win32.ActiveCfg = Release|Win32 - {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release|Win32.Build.0 = Release|Win32 - {925D5863-2F77-41B7-96F1-CC814762C40F}.Debug|Win32.ActiveCfg = Debug|Win32 - {925D5863-2F77-41B7-96F1-CC814762C40F}.Debug|Win32.Build.0 = Debug|Win32 - {925D5863-2F77-41B7-96F1-CC814762C40F}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {925D5863-2F77-41B7-96F1-CC814762C40F}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {925D5863-2F77-41B7-96F1-CC814762C40F}.Release|Win32.ActiveCfg = Release|Win32 - {925D5863-2F77-41B7-96F1-CC814762C40F}.Release|Win32.Build.0 = Release|Win32 - {1333D945-B228-4845-9C91-C1B67AEEAED5}.Debug|Win32.ActiveCfg = Debug|Win32 - {1333D945-B228-4845-9C91-C1B67AEEAED5}.Debug|Win32.Build.0 = Debug|Win32 - {1333D945-B228-4845-9C91-C1B67AEEAED5}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {1333D945-B228-4845-9C91-C1B67AEEAED5}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {1333D945-B228-4845-9C91-C1B67AEEAED5}.Release|Win32.ActiveCfg = Release|Win32 - {1333D945-B228-4845-9C91-C1B67AEEAED5}.Release|Win32.Build.0 = Release|Win32 - {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Debug|Win32.ActiveCfg = Debug|Win32 - {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Debug|Win32.Build.0 = Debug|Win32 - {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Release|Win32.ActiveCfg = Release|Win32 - {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Release|Win32.Build.0 = Release|Win32 - {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Debug|Win32.ActiveCfg = Debug|Win32 - {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Debug|Win32.Build.0 = Debug|Win32 - {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Release|Win32.ActiveCfg = Release|Win32 - {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Release|Win32.Build.0 = Release|Win32 - {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Debug|Win32.ActiveCfg = Debug|Win32 - {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Debug|Win32.Build.0 = Debug|Win32 - {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Release|Win32.ActiveCfg = Release|Win32 - {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Release|Win32.Build.0 = Release|Win32 - {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Debug|Win32.ActiveCfg = Debug|Win32 - {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Debug|Win32.Build.0 = Debug|Win32 - {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Release|Win32.ActiveCfg = Release|Win32 - {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Release|Win32.Build.0 = Release|Win32 - {0A696379-10A2-43FB-A26C-B42456FCF657}.Debug|Win32.ActiveCfg = Debug|Win32 - {0A696379-10A2-43FB-A26C-B42456FCF657}.Debug|Win32.Build.0 = Debug|Win32 - {0A696379-10A2-43FB-A26C-B42456FCF657}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {0A696379-10A2-43FB-A26C-B42456FCF657}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {0A696379-10A2-43FB-A26C-B42456FCF657}.Release|Win32.ActiveCfg = Release|Win32 - {0A696379-10A2-43FB-A26C-B42456FCF657}.Release|Win32.Build.0 = Release|Win32 - {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Debug|Win32.ActiveCfg = Debug|Win32 - {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Debug|Win32.Build.0 = Debug|Win32 - {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Release|Win32.ActiveCfg = Release|Win32 - {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Release|Win32.Build.0 = Release|Win32 - {0A98B714-818C-4DD3-A07C-BDD16399F362}.Debug|Win32.ActiveCfg = Debug|Win32 - {0A98B714-818C-4DD3-A07C-BDD16399F362}.Debug|Win32.Build.0 = Debug|Win32 - {0A98B714-818C-4DD3-A07C-BDD16399F362}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {0A98B714-818C-4DD3-A07C-BDD16399F362}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {0A98B714-818C-4DD3-A07C-BDD16399F362}.Release|Win32.ActiveCfg = Release|Win32 - {0A98B714-818C-4DD3-A07C-BDD16399F362}.Release|Win32.Build.0 = Release|Win32 - {78536B46-8307-4AE5-933E-0CADE2887AFB}.Debug|Win32.ActiveCfg = Debug|Win32 - {78536B46-8307-4AE5-933E-0CADE2887AFB}.Debug|Win32.Build.0 = Debug|Win32 - {78536B46-8307-4AE5-933E-0CADE2887AFB}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {78536B46-8307-4AE5-933E-0CADE2887AFB}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {78536B46-8307-4AE5-933E-0CADE2887AFB}.Release|Win32.ActiveCfg = Release|Win32 - {78536B46-8307-4AE5-933E-0CADE2887AFB}.Release|Win32.Build.0 = Release|Win32 - {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Debug|Win32.ActiveCfg = Debug|Win32 - {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Debug|Win32.Build.0 = Debug|Win32 - {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Release|Win32.ActiveCfg = Release|Win32 - {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Release|Win32.Build.0 = Release|Win32 - {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Debug|Win32.ActiveCfg = Debug|Win32 - {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Debug|Win32.Build.0 = Debug|Win32 - {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Release|Win32.ActiveCfg = Release|Win32 - {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Release|Win32.Build.0 = Release|Win32 - {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Debug|Win32.ActiveCfg = Debug|Win32 - {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Debug|Win32.Build.0 = Debug|Win32 - {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Release|Win32.ActiveCfg = Release|Win32 - {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Release|Win32.Build.0 = Release|Win32 - {79729949-F144-4098-BFE9-B6320E6AC3F6}.Debug|Win32.ActiveCfg = Debug|Win32 - {79729949-F144-4098-BFE9-B6320E6AC3F6}.Debug|Win32.Build.0 = Debug|Win32 - {79729949-F144-4098-BFE9-B6320E6AC3F6}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {79729949-F144-4098-BFE9-B6320E6AC3F6}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {79729949-F144-4098-BFE9-B6320E6AC3F6}.Release|Win32.ActiveCfg = Release|Win32 - {79729949-F144-4098-BFE9-B6320E6AC3F6}.Release|Win32.Build.0 = Release|Win32 - {21D2B291-80F4-476C-A643-B8A7034DF95F}.Debug|Win32.ActiveCfg = Debug|Win32 - {21D2B291-80F4-476C-A643-B8A7034DF95F}.Debug|Win32.Build.0 = Debug|Win32 - {21D2B291-80F4-476C-A643-B8A7034DF95F}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {21D2B291-80F4-476C-A643-B8A7034DF95F}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {21D2B291-80F4-476C-A643-B8A7034DF95F}.Release|Win32.ActiveCfg = Release|Win32 - {21D2B291-80F4-476C-A643-B8A7034DF95F}.Release|Win32.Build.0 = Release|Win32 - {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Debug|Win32.ActiveCfg = Debug|Win32 - {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Debug|Win32.Build.0 = Debug|Win32 - {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Release|Win32.ActiveCfg = Release|Win32 - {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Release|Win32.Build.0 = Release|Win32 - {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Debug|Win32.ActiveCfg = Debug|Win32 - {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Debug|Win32.Build.0 = Debug|Win32 - {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Release|Win32.ActiveCfg = Release|Win32 - {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Release|Win32.Build.0 = Release|Win32 - {8D186AB4-E544-42D6-B192-1AE2C946875E}.Debug|Win32.ActiveCfg = Debug|Win32 - {8D186AB4-E544-42D6-B192-1AE2C946875E}.Debug|Win32.Build.0 = Debug|Win32 - {8D186AB4-E544-42D6-B192-1AE2C946875E}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {8D186AB4-E544-42D6-B192-1AE2C946875E}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {8D186AB4-E544-42D6-B192-1AE2C946875E}.Release|Win32.ActiveCfg = Release|Win32 - {8D186AB4-E544-42D6-B192-1AE2C946875E}.Release|Win32.Build.0 = Release|Win32 - {C0826A05-9143-4545-B5DE-811C188CB54E}.Debug|Win32.ActiveCfg = Debug|Win32 - {C0826A05-9143-4545-B5DE-811C188CB54E}.Debug|Win32.Build.0 = Debug|Win32 - {C0826A05-9143-4545-B5DE-811C188CB54E}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 - {C0826A05-9143-4545-B5DE-811C188CB54E}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 - {C0826A05-9143-4545-B5DE-811C188CB54E}.Release|Win32.ActiveCfg = Release|Win32 - {C0826A05-9143-4545-B5DE-811C188CB54E}.Release|Win32.Build.0 = Release|Win32 - {2148AAC5-5CE3-493E-8D82-439ABC2E8053}.Debug|Win32.ActiveCfg = Debug|Win32 - {2148AAC5-5CE3-493E-8D82-439ABC2E8053}.Debug|Win32.Build.0 = Debug|Win32 - {2148AAC5-5CE3-493E-8D82-439ABC2E8053}.Release_MultiThreaded|Win32.ActiveCfg = Release|Win32 - {2148AAC5-5CE3-493E-8D82-439ABC2E8053}.Release_MultiThreaded|Win32.Build.0 = Release|Win32 - {2148AAC5-5CE3-493E-8D82-439ABC2E8053}.Release|Win32.ActiveCfg = Release|Win32 - {2148AAC5-5CE3-493E-8D82-439ABC2E8053}.Release|Win32.Build.0 = Release|Win32 - {7C09E027-5484-4641-8310-BDDEB1EC8676}.Debug|Win32.ActiveCfg = Debug|Win32 - {7C09E027-5484-4641-8310-BDDEB1EC8676}.Debug|Win32.Build.0 = Debug|Win32 - {7C09E027-5484-4641-8310-BDDEB1EC8676}.Release_MultiThreaded|Win32.ActiveCfg = Release|Win32 - {7C09E027-5484-4641-8310-BDDEB1EC8676}.Release_MultiThreaded|Win32.Build.0 = Release|Win32 - {7C09E027-5484-4641-8310-BDDEB1EC8676}.Release|Win32.ActiveCfg = Release|Win32 - {7C09E027-5484-4641-8310-BDDEB1EC8676}.Release|Win32.Build.0 = Release|Win32 - {ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}.Debug|Win32.ActiveCfg = Debug|Win32 - {ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}.Debug|Win32.Build.0 = Debug|Win32 - {ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}.Release_MultiThreaded|Win32.ActiveCfg = Release|Win32 - {ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}.Release_MultiThreaded|Win32.Build.0 = Release|Win32 - {ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}.Release|Win32.ActiveCfg = Release|Win32 - {ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Library", "src\library_MSVC9.vcproj", "{CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Factory", "test\Factory\Factory_MSVC9.vcproj", "{925D5863-2F77-41B7-96F1-CC814762C40F}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Longevity", "test\Longevity\Longevity_MSVC9.vcproj", "{1333D945-B228-4845-9C91-C1B67AEEAED5}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OrderedStatic", "test\OrderedStatic\OrderedStatic_MSVC9.vcproj", "{0DCBE03A-DAC7-4669-B29B-102D8F563736}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SafeFormat", "test\SafeFormat\SafeFormat_MSVC9.vcproj", "{C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ScopeGuard", "test\ScopeGuard\ScopeGuard_MSVC9.vcproj", "{D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Singleton", "test\Singleton\Singleton_MSVC9.vcproj", "{9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Visitor", "test\Visitor\Visitor_MSVC9.vcproj", "{0A696379-10A2-43FB-A26C-B42456FCF657}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flex_string", "test\flex_string\flex_string_MSVC9.vcproj", "{2022B9AD-34CA-4FDA-80C2-42805FABE65B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmallObjCompare", "test\SmallObj\SmallObjCompare_MSVC9.vcproj", "{0A98B714-818C-4DD3-A07C-BDD16399F362}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmallObjSingleton", "test\SmallObj\SmallObjSingleton_MSVC9.vcproj", "{78536B46-8307-4AE5-933E-0CADE2887AFB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DeletableSingleton", "test\DeletableSingleton\DeletableSingleton_MSVC9.vcproj", "{B87B3522-7DAA-400D-A47D-A74B9B8B3552}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DefaultAlloc", "test\SmallObj\DefaultAlloc_MSVC9.vcproj", "{D490B134-B794-42CF-8AF8-9FDA524B9D3B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SmartPtr", "test\SmartPtr\SmartPtr_MSVC9.vcproj", "{D7AB4FEF-E7AF-443D-93A5-37F323F2042D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSVCUnitTest", "test\RegressionTest\MSVCUnitTest_MSVC9.vcproj", "{79729949-F144-4098-BFE9-B6320E6AC3F6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Pimpl", "test\Pimpl\Pimpl_MSVC9.vcproj", "{21D2B291-80F4-476C-A643-B8A7034DF95F}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LockingPtr", "test\LockingPtr\LockingPtr_MSVC9.vcproj", "{25766C3F-C0D8-429F-A212-5FA3537B3E1C}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Function", "test\Function\Function_MSVC9.vcproj", "{2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CachedFactory", "test\CachedFactory\CachedFactory_MSVC9.vcproj", "{8D186AB4-E544-42D6-B192-1AE2C946875E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CheckReturn", "test\CheckReturn\CheckReturn_MSVC9.vcproj", "{C0826A05-9143-4545-B5DE-811C188CB54E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Checker", "test\Checker\Checker_MSVC_9.vcproj", "{2148AAC5-5CE3-493E-8D82-439ABC2E8053}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LevelMutex", "test\LevelMutex\LevelMutex_MSVC_9.vcproj", "{7C09E027-5484-4641-8310-BDDEB1EC8676}" + ProjectSection(ProjectDependencies) = postProject + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} = {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SafeBits", "test\SafeBits\SafeBits_MSVC_9.vcproj", "{ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release_MultiThreaded|Win32 = Release_MultiThreaded|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Debug|Win32.ActiveCfg = Debug|Win32 + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Debug|Win32.Build.0 = Debug|Win32 + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release|Win32.ActiveCfg = Release|Win32 + {CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}.Release|Win32.Build.0 = Release|Win32 + {925D5863-2F77-41B7-96F1-CC814762C40F}.Debug|Win32.ActiveCfg = Debug|Win32 + {925D5863-2F77-41B7-96F1-CC814762C40F}.Debug|Win32.Build.0 = Debug|Win32 + {925D5863-2F77-41B7-96F1-CC814762C40F}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {925D5863-2F77-41B7-96F1-CC814762C40F}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {925D5863-2F77-41B7-96F1-CC814762C40F}.Release|Win32.ActiveCfg = Release|Win32 + {925D5863-2F77-41B7-96F1-CC814762C40F}.Release|Win32.Build.0 = Release|Win32 + {1333D945-B228-4845-9C91-C1B67AEEAED5}.Debug|Win32.ActiveCfg = Debug|Win32 + {1333D945-B228-4845-9C91-C1B67AEEAED5}.Debug|Win32.Build.0 = Debug|Win32 + {1333D945-B228-4845-9C91-C1B67AEEAED5}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {1333D945-B228-4845-9C91-C1B67AEEAED5}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {1333D945-B228-4845-9C91-C1B67AEEAED5}.Release|Win32.ActiveCfg = Release|Win32 + {1333D945-B228-4845-9C91-C1B67AEEAED5}.Release|Win32.Build.0 = Release|Win32 + {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Debug|Win32.ActiveCfg = Debug|Win32 + {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Debug|Win32.Build.0 = Debug|Win32 + {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Release|Win32.ActiveCfg = Release|Win32 + {0DCBE03A-DAC7-4669-B29B-102D8F563736}.Release|Win32.Build.0 = Release|Win32 + {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Debug|Win32.ActiveCfg = Debug|Win32 + {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Debug|Win32.Build.0 = Debug|Win32 + {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Release|Win32.ActiveCfg = Release|Win32 + {C161D9DD-EB96-44D0-9CDD-ABF22ECBC359}.Release|Win32.Build.0 = Release|Win32 + {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Debug|Win32.ActiveCfg = Debug|Win32 + {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Debug|Win32.Build.0 = Debug|Win32 + {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Release|Win32.ActiveCfg = Release|Win32 + {D5E7BAC2-A961-4ECC-ADA4-82D7510952BA}.Release|Win32.Build.0 = Release|Win32 + {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Debug|Win32.ActiveCfg = Debug|Win32 + {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Debug|Win32.Build.0 = Debug|Win32 + {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Release|Win32.ActiveCfg = Release|Win32 + {9F489E5D-9F29-4235-A9D4-79B5BA4EC48D}.Release|Win32.Build.0 = Release|Win32 + {0A696379-10A2-43FB-A26C-B42456FCF657}.Debug|Win32.ActiveCfg = Debug|Win32 + {0A696379-10A2-43FB-A26C-B42456FCF657}.Debug|Win32.Build.0 = Debug|Win32 + {0A696379-10A2-43FB-A26C-B42456FCF657}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {0A696379-10A2-43FB-A26C-B42456FCF657}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {0A696379-10A2-43FB-A26C-B42456FCF657}.Release|Win32.ActiveCfg = Release|Win32 + {0A696379-10A2-43FB-A26C-B42456FCF657}.Release|Win32.Build.0 = Release|Win32 + {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Debug|Win32.ActiveCfg = Debug|Win32 + {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Debug|Win32.Build.0 = Debug|Win32 + {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Release|Win32.ActiveCfg = Release|Win32 + {2022B9AD-34CA-4FDA-80C2-42805FABE65B}.Release|Win32.Build.0 = Release|Win32 + {0A98B714-818C-4DD3-A07C-BDD16399F362}.Debug|Win32.ActiveCfg = Debug|Win32 + {0A98B714-818C-4DD3-A07C-BDD16399F362}.Debug|Win32.Build.0 = Debug|Win32 + {0A98B714-818C-4DD3-A07C-BDD16399F362}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {0A98B714-818C-4DD3-A07C-BDD16399F362}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {0A98B714-818C-4DD3-A07C-BDD16399F362}.Release|Win32.ActiveCfg = Release|Win32 + {0A98B714-818C-4DD3-A07C-BDD16399F362}.Release|Win32.Build.0 = Release|Win32 + {78536B46-8307-4AE5-933E-0CADE2887AFB}.Debug|Win32.ActiveCfg = Debug|Win32 + {78536B46-8307-4AE5-933E-0CADE2887AFB}.Debug|Win32.Build.0 = Debug|Win32 + {78536B46-8307-4AE5-933E-0CADE2887AFB}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {78536B46-8307-4AE5-933E-0CADE2887AFB}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {78536B46-8307-4AE5-933E-0CADE2887AFB}.Release|Win32.ActiveCfg = Release|Win32 + {78536B46-8307-4AE5-933E-0CADE2887AFB}.Release|Win32.Build.0 = Release|Win32 + {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Debug|Win32.ActiveCfg = Debug|Win32 + {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Debug|Win32.Build.0 = Debug|Win32 + {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Release|Win32.ActiveCfg = Release|Win32 + {B87B3522-7DAA-400D-A47D-A74B9B8B3552}.Release|Win32.Build.0 = Release|Win32 + {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Debug|Win32.ActiveCfg = Debug|Win32 + {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Debug|Win32.Build.0 = Debug|Win32 + {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Release|Win32.ActiveCfg = Release|Win32 + {D490B134-B794-42CF-8AF8-9FDA524B9D3B}.Release|Win32.Build.0 = Release|Win32 + {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Debug|Win32.ActiveCfg = Debug|Win32 + {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Debug|Win32.Build.0 = Debug|Win32 + {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Release|Win32.ActiveCfg = Release|Win32 + {D7AB4FEF-E7AF-443D-93A5-37F323F2042D}.Release|Win32.Build.0 = Release|Win32 + {79729949-F144-4098-BFE9-B6320E6AC3F6}.Debug|Win32.ActiveCfg = Debug|Win32 + {79729949-F144-4098-BFE9-B6320E6AC3F6}.Debug|Win32.Build.0 = Debug|Win32 + {79729949-F144-4098-BFE9-B6320E6AC3F6}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {79729949-F144-4098-BFE9-B6320E6AC3F6}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {79729949-F144-4098-BFE9-B6320E6AC3F6}.Release|Win32.ActiveCfg = Release|Win32 + {79729949-F144-4098-BFE9-B6320E6AC3F6}.Release|Win32.Build.0 = Release|Win32 + {21D2B291-80F4-476C-A643-B8A7034DF95F}.Debug|Win32.ActiveCfg = Debug|Win32 + {21D2B291-80F4-476C-A643-B8A7034DF95F}.Debug|Win32.Build.0 = Debug|Win32 + {21D2B291-80F4-476C-A643-B8A7034DF95F}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {21D2B291-80F4-476C-A643-B8A7034DF95F}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {21D2B291-80F4-476C-A643-B8A7034DF95F}.Release|Win32.ActiveCfg = Release|Win32 + {21D2B291-80F4-476C-A643-B8A7034DF95F}.Release|Win32.Build.0 = Release|Win32 + {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Debug|Win32.ActiveCfg = Debug|Win32 + {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Debug|Win32.Build.0 = Debug|Win32 + {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Release|Win32.ActiveCfg = Release|Win32 + {25766C3F-C0D8-429F-A212-5FA3537B3E1C}.Release|Win32.Build.0 = Release|Win32 + {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Debug|Win32.ActiveCfg = Debug|Win32 + {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Debug|Win32.Build.0 = Debug|Win32 + {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Release|Win32.ActiveCfg = Release|Win32 + {2DE18D06-0F3A-4C6D-AF2B-40E074B3C3DC}.Release|Win32.Build.0 = Release|Win32 + {8D186AB4-E544-42D6-B192-1AE2C946875E}.Debug|Win32.ActiveCfg = Debug|Win32 + {8D186AB4-E544-42D6-B192-1AE2C946875E}.Debug|Win32.Build.0 = Debug|Win32 + {8D186AB4-E544-42D6-B192-1AE2C946875E}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {8D186AB4-E544-42D6-B192-1AE2C946875E}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {8D186AB4-E544-42D6-B192-1AE2C946875E}.Release|Win32.ActiveCfg = Release|Win32 + {8D186AB4-E544-42D6-B192-1AE2C946875E}.Release|Win32.Build.0 = Release|Win32 + {C0826A05-9143-4545-B5DE-811C188CB54E}.Debug|Win32.ActiveCfg = Debug|Win32 + {C0826A05-9143-4545-B5DE-811C188CB54E}.Debug|Win32.Build.0 = Debug|Win32 + {C0826A05-9143-4545-B5DE-811C188CB54E}.Release_MultiThreaded|Win32.ActiveCfg = Release_MultiThreaded|Win32 + {C0826A05-9143-4545-B5DE-811C188CB54E}.Release_MultiThreaded|Win32.Build.0 = Release_MultiThreaded|Win32 + {C0826A05-9143-4545-B5DE-811C188CB54E}.Release|Win32.ActiveCfg = Release|Win32 + {C0826A05-9143-4545-B5DE-811C188CB54E}.Release|Win32.Build.0 = Release|Win32 + {2148AAC5-5CE3-493E-8D82-439ABC2E8053}.Debug|Win32.ActiveCfg = Debug|Win32 + {2148AAC5-5CE3-493E-8D82-439ABC2E8053}.Debug|Win32.Build.0 = Debug|Win32 + {2148AAC5-5CE3-493E-8D82-439ABC2E8053}.Release_MultiThreaded|Win32.ActiveCfg = Release|Win32 + {2148AAC5-5CE3-493E-8D82-439ABC2E8053}.Release_MultiThreaded|Win32.Build.0 = Release|Win32 + {2148AAC5-5CE3-493E-8D82-439ABC2E8053}.Release|Win32.ActiveCfg = Release|Win32 + {2148AAC5-5CE3-493E-8D82-439ABC2E8053}.Release|Win32.Build.0 = Release|Win32 + {7C09E027-5484-4641-8310-BDDEB1EC8676}.Debug|Win32.ActiveCfg = Debug|Win32 + {7C09E027-5484-4641-8310-BDDEB1EC8676}.Debug|Win32.Build.0 = Debug|Win32 + {7C09E027-5484-4641-8310-BDDEB1EC8676}.Release_MultiThreaded|Win32.ActiveCfg = Release|Win32 + {7C09E027-5484-4641-8310-BDDEB1EC8676}.Release_MultiThreaded|Win32.Build.0 = Release|Win32 + {7C09E027-5484-4641-8310-BDDEB1EC8676}.Release|Win32.ActiveCfg = Release|Win32 + {7C09E027-5484-4641-8310-BDDEB1EC8676}.Release|Win32.Build.0 = Release|Win32 + {ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}.Debug|Win32.ActiveCfg = Debug|Win32 + {ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}.Debug|Win32.Build.0 = Debug|Win32 + {ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}.Release_MultiThreaded|Win32.ActiveCfg = Release|Win32 + {ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}.Release_MultiThreaded|Win32.Build.0 = Release|Win32 + {ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}.Release|Win32.ActiveCfg = Release|Win32 + {ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Property changes on: trunk/Loki_MSVC_9.sln ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/src/Library_MSVC9.vcproj =================================================================== --- trunk/src/Library_MSVC9.vcproj 2009-01-29 08:30:08 UTC (rev 957) +++ trunk/src/Library_MSVC9.vcproj 2009-01-29 17:38:55 UTC (rev 958) @@ -1,433 +1,433 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9.00" - Name="Library" - ProjectGUID="{CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}" - RootNamespace="Library" - Keyword="Win32Proj" - TargetFrameworkVersion="131072" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="Debug" - IntermediateDirectory="Debug" - ConfigurationType="4" - CharacterSet="0" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="-wd4996" - Optimization="0" - AdditionalIncludeDirectories="..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE _SECURE_SCL=1" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="4" - Detect64BitPortabilityProblems="false" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="../lib/loki_D.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="Release" - IntermediateDirectory="Release" - ConfigurationType="4" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - AdditionalIncludeDirectories="..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="4" - Detect64BitPortabilityProblems="false" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="../lib/loki.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release_MultiThreaded|Win32" - OutputDirectory="$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - AdditionalIncludeDirectories="..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="4" - Detect64BitPortabilityProblems="false" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="../lib/loki.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath="..\include\loki\AbstractFactory.h" - > - </File> - <File - RelativePath="..\include\loki\Allocator.h" - > - </File> - <File - RelativePath="..\include\loki\AssocVector.h" - > - </File> - <File - RelativePath="..\include\loki\CheckReturn.h" - > - </File> - <File - RelativePath="..\include\loki\ConstPolicy.h" - > - </File> - <File - RelativePath="..\include\loki\DataGenerators.h" - > - </File> - <File - RelativePath="..\include\loki\EmptyType.h" - > - </File> - <File - RelativePath="..\include\loki\Factory.h" - > - </File> - <File - RelativePath="..\include\loki\Function.h" - > - </File> - <File - RelativePath="..\include\loki\Functor.h" - > - </File> - <File - RelativePath="..\include\loki\HierarchyGenerators.h" - > - </File> - <File - RelativePath="..\include\loki\LevelMutex.h" - > - </File> - <File - RelativePath="..\include\loki\LockingPtr.h" - > - </File> - <File - RelativePath="..\include\loki\LokiExport.h" - > - </File> - <File - RelativePath="..\include\loki\LokiTypeInfo.h" - > - </File> - <File - RelativePath="..\include\loki\MultiMethods.h" - > - </File> - <File - RelativePath="..\include\loki\NullType.h" - > - </File> - <File - RelativePath="..\include\loki\OrderedStatic.h" - > - </File> - <File - RelativePath="..\include\loki\Pimpl.h" - > - </File> - <File - RelativePath="..\include\loki\RefToValue.h" - > - </File> - <File - RelativePath="..\include\loki\SafeBits.h" - > - </File> - <File - RelativePath="..\include\loki\SafeFormat.h" - > - </File> - <File - RelativePath="..\include\loki\ScopeGuard.h" - > - </File> - <File - RelativePath="..\include\loki\Sequence.h" - > - </File> - <File - RelativePath="..\include\loki\Singleton.h" - > - </File> - <File - RelativePath="..\include\loki\SmallObj.h" - > - </File> - <File - RelativePath="..\include\loki\SmartPtr.h" - > - </File> - <File - RelativePath="..\include\loki\static_check.h" - > - </File> - <File - RelativePath="..\include\loki\StrongPtr.h" - > - </File> - <File - RelativePath="..\include\loki\Threads.h" - > - </File> - <File - RelativePath="..\include\loki\Tuple.h" - > - </File> - <File - RelativePath="..\include\loki\Typelist.h" - > - </File> - <File - RelativePath="..\include\loki\TypelistMacros.h" - > - </File> - <File - RelativePath="..\include\loki\TypeManip.h" - > - </File> - <File - RelativePath="..\include\loki\TypeTraits.h" - > - </File> - <File - RelativePath="..\include\loki\Visitor.h" - > - </File> - <Filter - Name="flexstring" - > - <File - RelativePath="..\loki\include\loki\flex\allocatorstringstorage.h" - > - </File> - <File - RelativePath="..\loki\include\loki\flex\cowstringopt.h" - > - </File> - <File - RelativePath="..\loki\include\loki\flex\flex_string.h" - > - </File> - <File - RelativePath="..\loki\include\loki\flex\flex_string_details.h" - > - </File> - <File - RelativePath="..\loki\include\loki\flex\flex_string_shell.h" - > - </File> - <File - RelativePath="..\loki\include\loki\flex\simplestringstorage.h" - > - </File> - <File - RelativePath="..\loki\include\loki\flex\smallstringopt.h" - > - </File> - <File - RelativePath="..\loki\include\loki\flex\vectorstringstorage.h" - > - </File> - </Filter> - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\LevelMutex.cpp" - > - </File> - <File - RelativePath=".\OrderedStatic.cpp" - > - </File> - <File - RelativePath=".\SafeFormat.cpp" - > - </File> - <File - RelativePath=".\Singleton.cpp" - > - </File> - <File - RelativePath=".\SmallObj.cpp" - > - </File> - <File - RelativePath=".\SmartPtr.cpp" - > - </File> - <File - RelativePath=".\StrongPtr.cpp" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="Library" + ProjectGUID="{CBDB8E7A-4286-4AE3-A190-BA33D7C53FF0}" + RootNamespace="Library" + Keyword="Win32Proj" + TargetFrameworkVersion="131072" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="4" + CharacterSet="0" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="-wd4996" + Optimization="0" + AdditionalIncludeDirectories="..\include" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE _SECURE_SCL=1" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="../lib/loki_D.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="4" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="..\include" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="../lib/loki.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release_MultiThreaded|Win32" + OutputDirectory="$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="4" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="..\include" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="4" + Detect64BitPortabilityProblems="false" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="../lib/loki.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath="..\include\loki\AbstractFactory.h" + > + </File> + <File + RelativePath="..\include\loki\Allocator.h" + > + </File> + <File + RelativePath="..\include\loki\AssocVector.h" + > + </File> + <File + RelativePath="..\include\loki\CheckReturn.h" + > + </File> + <File + RelativePath="..\include\loki\ConstPolicy.h" + > + </File> + <File + RelativePath="..\include\loki\DataGenerators.h" + > + </File> + <File + RelativePath="..\include\loki\EmptyType.h" + > + </File> + <File + RelativePath="..\include\loki\Factory.h" + > + </File> + <File + RelativePath="..\include\loki\Function.h" + > + </File> + <File + RelativePath="..\include\loki\Functor.h" + > + </File> + <File + RelativePath="..\include\loki\HierarchyGenerators.h" + > + </File> + <File + RelativePath="..\include\loki\LevelMutex.h" + > + </File> + <File + RelativePath="..\include\loki\LockingPtr.h" + > + </File> + <File + RelativePath="..\include\loki\LokiExport.h" + > + </File> + <File + RelativePath="..\include\loki\LokiTypeInfo.h" + > + </File> + <File + RelativePath="..\include\loki\MultiMethods.h" + > + </File> + <File + RelativePath="..\include\loki\NullType.h" + > + </File> + <File + RelativePath="..\include\loki\OrderedStatic.h" + > + </File> + <File + RelativePath="..\include\loki\Pimpl.h" + > + </File> + <File + RelativePath="..\include\loki\RefToValue.h" + > + </File> + <File + RelativePath="..\include\loki\SafeBits.h" + > + </File> + <File + RelativePath="..\include\loki\SafeFormat.h" + > + </File> + <File + RelativePath="..\include\loki\ScopeGuard.h" + > + </File> + <File + RelativePath="..\include\loki\Sequence.h" + > + </File> + <File + RelativePath="..\include\loki\Singleton.h" + > + </File> + <File + RelativePath="..\include\loki\SmallObj.h" + > + </File> + <File + RelativePath="..\include\loki\SmartPtr.h" + > + </File> + <File + RelativePath="..\include\loki\static_check.h" + > + </File> + <File + RelativePath="..\include\loki\StrongPtr.h" + > + </File> + <File + RelativePath="..\include\loki\Threads.h" + > + </File> + <File + RelativePath="..\include\loki\Tuple.h" + > + </File> + <File + RelativePath="..\include\loki\Typelist.h" + > + </File> + <File + RelativePath="..\include\loki\TypelistMacros.h" + > + </File> + <File + RelativePath="..\include\loki\TypeManip.h" + > + </File> + <File + RelativePath="..\include\loki\TypeTraits.h" + > + </File> + <File + RelativePath="..\include\loki\Visitor.h" + > + </File> + <Filter + Name="flexstring" + > + <File + RelativePath="..\loki\include\loki\flex\allocatorstringstorage.h" + > + </File> + <File + RelativePath="..\loki\include\loki\flex\cowstringopt.h" + > + </File> + <File + RelativePath="..\loki\include\loki\flex\flex_string.h" + > + </File> + <File + RelativePath="..\loki\include\loki\flex\flex_string_details.h" + > + </File> + <File + RelativePath="..\loki\include\loki\flex\flex_string_shell.h" + > + </File> + <File + RelativePath="..\loki\include\loki\flex\simplestringstorage.h" + > + </File> + <File + RelativePath="..\loki\include\loki\flex\smallstringopt.h" + > + </File> + <File + RelativePath="..\loki\include\loki\flex\vectorstringstorage.h" + > + </File> + </Filter> + </Filter> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\LevelMutex.cpp" + > + </File> + <File + RelativePath=".\OrderedStatic.cpp" + > + </File> + <File + RelativePath=".\SafeFormat.cpp" + > + </File> + <File + RelativePath=".\Singleton.cpp" + > + </File> + <File + RelativePath=".\SmallObj.cpp" + > + </File> + <File + RelativePath=".\SmartPtr.cpp" + > + </File> + <File + RelativePath=".\StrongPtr.cpp" + > + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Property changes on: trunk/src/Library_MSVC9.vcproj ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/test/CachedFactory/CachedFactory_MSVC9.vcproj =================================================================== --- trunk/test/CachedFactory/CachedFactory_MSVC9.vcproj 2009-01-29 08:30:08 UTC (rev 957) +++ trunk/test/CachedFactory/CachedFactory_MSVC9.vcproj 2009-01-29 17:38:55 UTC (rev 958) @@ -1,267 +1,267 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9.00" - Name="CachedFactory" - ProjectGUID="{8D186AB4-E544-42D6-B192-1AE2C946875E}" - RootNamespace="CachedFactory" - Keyword="Win32Proj" - TargetFrameworkVersion="131072" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="Debug" - IntermediateDirectory="Debug" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="-wd4996" - Optimization="0" - AdditionalIncludeDirectories="..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE _SECURE_SCL=1" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="4" - Detect64BitPortabilityProblems="false" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - GenerateDebugInformation="true" - RandomizedBaseAddress="1" - DataExecutionPrevention="0" - /> - <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="Release" - IntermediateDirectory="Release" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - AdditionalIncludeDirectories="..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="4" - Detect64BitPortabilityProblems="false" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="1" - 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> - <Configuration - Name="Release_MultiThreaded|Win32" - OutputDirectory="$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - AdditionalIncludeDirectories="..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="4" - Detect64BitPortabilityProblems="false" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEve... [truncated message content] |
From: <jfb...@us...> - 2009-03-13 13:55:09
|
Revision: 1009 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=1009&view=rev Author: jfbastien Date: 2009-03-13 13:54:51 +0000 (Fri, 13 Mar 2009) Log Message: ----------- Bug 2686155: flex_string is missing input_iterator methods Modified Paths: -------------- trunk/include/loki/flex/flex_string_shell.h trunk/test/flex_string/main.cpp Modified: trunk/include/loki/flex/flex_string_shell.h =================================================================== --- trunk/include/loki/flex/flex_string_shell.h 2009-03-13 12:07:15 UTC (rev 1008) +++ trunk/include/loki/flex/flex_string_shell.h 2009-03-13 13:54:51 UTC (rev 1009) @@ -645,16 +645,16 @@ } template <class InputIterator> - void InsertImpl(iterator i1, iterator i2, - InputIterator b, InputIterator e, std::input_iterator_tag) + void InsertImpl(iterator insertPosition, + InputIterator inputBegin, InputIterator inputEnd, std::input_iterator_tag) { - flex_string temp(begin(), i1); - for (; b != e; ++b) + flex_string temporary(begin(), insertPosition); + for (; inputBegin != inputEnd; ++inputBegin) { - temp.push_back(*b); + temporary.push_back(*inputBegin); } - temp.append(i2, end()); - swap(temp); + temporary.append(insertPosition, end()); + swap(temporary); } public: Modified: trunk/test/flex_string/main.cpp =================================================================== --- trunk/test/flex_string/main.cpp 2009-03-13 12:07:15 UTC (rev 1008) +++ trunk/test/flex_string/main.cpp 2009-03-13 13:54:51 UTC (rev 1009) @@ -36,6 +36,7 @@ #include <cstring> #include <ctime> #include <iostream> +#include <iterator> #include <typeinfo> #include <sstream> #include <utility> @@ -621,6 +622,19 @@ return result; } + template<class String> + String constructor_iterator_iterator__istream_iterator() + { + // 21.3.5 + String random1(RandomString<String>(MaxString<String>::value)); + typedef typename String::value_type value_type; + std::basic_stringstream<value_type, std::char_traits<value_type> > stream; + stream << random1; + std::istreambuf_iterator<value_type, std::char_traits<value_type> > begin(stream), end; + String result(begin, end); + return result; + } + // TODO: destructor template<class String> @@ -1052,6 +1066,20 @@ } template<class String> + String append_iterator_iterator__istream_iterator() + { + // 21.3.5 + String random1(RandomString<String>(MaxString<String>::value)); + String random2(RandomString<String>(MaxString<String>::value)); + typedef typename String::value_type value_type; + std::basic_stringstream<value_type, std::char_traits<value_type> > stream; + stream << random1; + std::istreambuf_iterator<value_type, std::char_traits<value_type> > begin(stream), end; + random2.append(begin, end); + return random2; + } + + template<class String> String push_back_char() { // 21.3.5 @@ -1246,6 +1274,20 @@ } template<class String> + String assign_iterator_iterator__istream_iterator() + { + // 21.3.5 + String random1(RandomString<String>(MaxString<String>::value)); + String random2(RandomString<String>(MaxString<String>::value)); + typedef typename String::value_type value_type; + std::basic_stringstream<value_type, std::char_traits<value_type> > stream; + stream << random1; + std::istreambuf_iterator<value_type, std::char_traits<value_type> > begin(stream), end; + random2.assign(begin, end); + return random2; + } + + template<class String> String insert_position_string() { // 21.3.5 @@ -1406,7 +1448,7 @@ } template<class String> - String insert_iterator_iterator() + String insert_iterator_iterator_iterator() { // 21.3.5 String random1(RandomString<String>(MaxString<String>::value)); @@ -1417,7 +1459,7 @@ } template<class String> - String insert_iterator_iterator__self() + String insert_iterator_iterator_iterator__self() { // 21.3.5 String random1(RandomString<String>(MaxString<String>::value)); @@ -1427,7 +1469,7 @@ } template<class String> - String insert_iterator_iterator__selfcopy() + String insert_iterator_iterator_iterator__selfcopy() { // 21.3.5 String random1(RandomString<String>(MaxString<String>::value)); @@ -1438,7 +1480,7 @@ } template<class String> - String insert_iterator_iterator__self_reverse() + String insert_iterator_iterator_iterator__self_reverse() { // 21.3.5 String random1(RandomString<String>(MaxString<String>::value)); @@ -1448,7 +1490,7 @@ } template<class String> - String insert_iterator_iterator__selfcopy_reverse() + String insert_iterator_iterator_iterator__selfcopy_reverse() { // 21.3.5 String random1(RandomString<String>(MaxString<String>::value)); @@ -1459,6 +1501,21 @@ } template<class String> + String insert_iterator_iterator_iterator__istream_iterator() + { + // 21.3.5 + String random1(RandomString<String>(MaxString<String>::value)); + String random2(RandomString<String>(MaxString<String>::value)); + const typename String::size_type position = random(0, random2.size()); + typedef typename String::value_type value_type; + std::basic_stringstream<value_type, std::char_traits<value_type> > stream; + stream << random1; + std::istreambuf_iterator<value_type, std::char_traits<value_type> > begin(stream), end; + random2.insert(random2.begin() + position, begin, end); + return random2; + } + + template<class String> String erase_position_number() { // 21.3.5 @@ -1843,6 +1900,22 @@ } template<class String> + String replace_iterator_iterator_iterator_iterator__istream_iterator() + { + // 21.3.5 + String random1(RandomString<String>(MaxString<String>::value)); + String random2(RandomString<String>(MaxString<String>::value)); + const typename String::size_type position1 = random(0, random1.size()); + const typename String::size_type position2 = random(position1, random1.size()); + typedef typename String::value_type value_type; + std::basic_stringstream<value_type, std::char_traits<value_type> > stream; + stream << random2; + std::istreambuf_iterator<value_type, std::char_traits<value_type> > begin(stream), end; + random1.replace(random1.begin() + position1, random1.begin() + position2, begin, end); + return random1; + } + + template<class String> String copy_char_number_position() { // 21.3.5 @@ -2726,6 +2799,7 @@ ADD_TEST(constructor_cstr_number); ADD_TEST(constructor_number_char); ADD_TEST(constructor_iterator_iterator); + ADD_TEST(constructor_iterator_iterator__istream_iterator); ADD_TEST(operator_equal_string); ADD_TEST(operator_equal_string__self); ADD_TEST(operator_equal_string__selfCopy); @@ -2765,6 +2839,7 @@ ADD_TEST(append_iterator_iterator__selfcopy); ADD_TEST(append_iterator_iterator__self_reverse); ADD_TEST(append_iterator_iterator__selfcopy_reverse); + ADD_TEST(append_iterator_iterator__istream_iterator); ADD_TEST(push_back_char); ADD_TEST(assign_string); ADD_TEST(assign_string__self); @@ -2784,6 +2859,7 @@ ADD_TEST(assign_iterator_iterator__selfcopy); ADD_TEST(assign_iterator_iterator__self_reverse); ADD_TEST(assign_iterator_iterator__selfcopy_reverse); + ADD_TEST(assign_iterator_iterator__istream_iterator); ADD_TEST(insert_position_string); ADD_TEST(insert_position_string__self); ADD_TEST(insert_position_string__selfcopy); @@ -2798,11 +2874,12 @@ ADD_TEST(insert_position_cstr__selfcopy); ADD_TEST(insert_iterator_char); ADD_TEST(insert_position_number_char); - ADD_TEST(insert_iterator_iterator); - ADD_TEST(insert_iterator_iterator__self); - ADD_TEST(insert_iterator_iterator__selfcopy); - ADD_TEST(insert_iterator_iterator__self_reverse); - ADD_TEST(insert_iterator_iterator__selfcopy_reverse); + ADD_TEST(insert_iterator_iterator_iterator); + ADD_TEST(insert_iterator_iterator_iterator__self); + ADD_TEST(insert_iterator_iterator_iterator__selfcopy); + ADD_TEST(insert_iterator_iterator_iterator__self_reverse); + ADD_TEST(insert_iterator_iterator_iterator__selfcopy_reverse); + ADD_TEST(insert_iterator_iterator_iterator__istream_iterator); ADD_TEST(erase_position_number); ADD_TEST(erase_iterator); ADD_TEST(erase_iterator_iterator); @@ -2832,6 +2909,7 @@ ADD_TEST(replace_iterator_iterator_iterator_iterator); ADD_TEST(replace_iterator_iterator_iterator_iterator__self); ADD_TEST(replace_iterator_iterator_iterator_iterator__selfcopy); + ADD_TEST(replace_iterator_iterator_iterator_iterator__istream_iterator); ADD_TEST(copy_char_number_position); ADD_TEST(swap); ADD_TEST(swap__self); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-11-02 05:48:10
|
Revision: 1048 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=1048&view=rev Author: rich_sposato Date: 2009-11-02 05:48:02 +0000 (Mon, 02 Nov 2009) Log Message: ----------- Moved thread_local macro code to separate header file. Added more error values to enum family. Modified Paths: -------------- trunk/include/loki/LevelMutex.h trunk/src/LevelMutex.cpp Modified: trunk/include/loki/LevelMutex.h =================================================================== --- trunk/include/loki/LevelMutex.h 2009-11-02 05:43:58 UTC (rev 1047) +++ trunk/include/loki/LevelMutex.h 2009-11-02 05:48:02 UTC (rev 1048) @@ -1,12 +1,12 @@ //////////////////////////////////////////////////////////////////////////////// // // LevelMutex facility for the Loki Library -// Copyright (c) 2008 Richard Sposato +// Copyright (c) 2008, 2009 Richard Sposato // The copyright on this file is protected under the terms of the MIT license. // -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. // // The author makes no representations about the suitability of this software @@ -35,36 +35,15 @@ #endif #if !defined(_WIN32) && !defined(_WIN64) - #include <unistd.h> // declares sleep under Linux + #include <unistd.h> // declares usleep under Linux #endif -/** @par thread_local Keyword - The mutexes require compilers to provide thread local storage - meaning each - thread gets its own copy of the data. The next version of C++ will have a - new keyword, thread_local for that purpose. Some existing compilers already - provide thread local storage using different syntax, so these lines use - thread_local to mimic that syntax. If your compiler provides thread local - storage but using different syntax besides "thread_local", you may want to - modify these lines. If your compiler does not support thread local storage, - you can't use LevelMutex. - */ -#ifndef LOKI_THREAD_LOCAL - #if defined( _MSC_VER ) - #if ( _MSC_VER >= 1300 ) - #define LOKI_THREAD_LOCAL __declspec( thread ) - #else - #error "Only Visual Studio versions 7.0 and after supported." - #endif +#include <loki/ThreadLocal.h> // Include Loki's form of thread_local declaration. - #elif ( __GNUC__ ) - #define LOKI_THREAD_LOCAL __thread +#if !defined( LOKI_THREAD_LOCAL ) + #warning "Your compiler will not allow Loki::LevelMutex." +#else - #else - #warning "Check if your compiler provides thread local storage." - #define LOKI_THREAD_LOCAL thread_local - #endif -#endif - #if defined( DEBUG ) || defined( _DEBUG ) #define LOKI_MUTEX_DEBUG_CODE( x ) x #else @@ -106,7 +85,11 @@ InvalidAttribute, ///< PThread mutex improperly initialized. InvalidAddress, ///< Bad pointer used to initialize a PThread mutex. ExceptionThrown, ///< Exception caught in mutex operation. + InvertedPriority, ///< Mutex already locked by thread with lower priority. MayDeadlock, ///< Locking this mutex may cause a deadlock. + NotPrivileged, ///< Program does not have privilege to initialize mutexes. + NotEnoughMemory, ///< Program does not have enough memory to initialize mutex. + NotEnoughResources, ///< Program does not have enough resources to initialize mutex. OtherError ///< Unknown error occurred. }; }; @@ -374,7 +357,7 @@ */ virtual MutexErrors::Type LockThis( unsigned int milliSeconds ) volatile = 0; - /// Called only by MultiUnlock to unlock each particular mutex within a container. + /// Called only by MultiUnlock to unlock each particular mutex within a container. virtual MutexErrors::Type UnlockThis( void ) volatile = 0; /// Pointer to singly-linked list of mutexes locked by the current thread. @@ -565,7 +548,7 @@ Implements a sleeping loop to wait for the mutex to unlock. @par Purpose - Since this class puts the thread to sleep for short intervals, you can use this + Since this class puts the thread to sleep for short intervals, you can use this class for most of your mutexes. Especially for locking any high level resources where any one operation on the resouce consumes many CPU cycles. The purpose of this mutex is to reduce the number of CPU cycles spent in idle loops. All @@ -1101,7 +1084,7 @@ /// Returns true if the mutex is locked by this object. inline bool IsLocked( void ) const { return m_locked; } - /// Provides access to mutex controlled by this. + /// Provides access to mutex controlled by this. const volatile LevelMutexInfo & GetMutex( void ) const { return m_mutex; } private: @@ -1179,7 +1162,7 @@ /// Returns true if the mutexes are locked by this object. inline bool IsLocked( void ) const { return m_locked; } - /// Provides access to the collection of mutexes controlled by this. + /// Provides access to the collection of mutexes controlled by this. const LevelMutexInfo::MutexContainer & GetMutexes( void ) const { return m_mutexes; } private: @@ -1202,4 +1185,6 @@ } // end namespace Loki +#endif // end else if compiler allows thread_local storage + #endif // end file guardian Modified: trunk/src/LevelMutex.cpp =================================================================== --- trunk/src/LevelMutex.cpp 2009-11-02 05:43:58 UTC (rev 1047) +++ trunk/src/LevelMutex.cpp 2009-11-02 05:48:02 UTC (rev 1048) @@ -1,7 +1,7 @@ //////////////////////////////////////////////////////////////////////////////// // // LevelMutex facility for the Loki Library -// Copyright (c) 2008 Richard Sposato +// Copyright (c) 2008, 2009 Richard Sposato // The copyright on this file is protected under the terms of the MIT license. // // Permission to use, copy, modify, distribute and sell this software for any @@ -18,37 +18,23 @@ /// @file LevelMutex.cpp Contains functions needed by LevelMutex class. + // ---------------------------------------------------------------------------- -// First assume the compiler does allow thread-local storage by #defining the -// macro which allows compiler to see the code inside this file. -// Then #undefine the macro for compilers which are known for not supporting -// thread-local storage. -#define COMPILER_ALLOWS_THREAD_LOCAL_STORAGE 1 +#include "../include/loki/LevelMutex.h" -// The __APPLE__ macro does not refer to a compiler, but to the Apple OSX operating system. -#if defined( __APPLE__ ) - #warning "GCC for Apple does not allow thread_local storage, so you can not use Loki::LevelMutex." - #undef COMPILER_ALLOWS_THREAD_LOCAL_STORAGE -#endif +#if defined( LOKI_THREAD_LOCAL ) -#if ( defined( __CYGWIN__ ) && ( __GNUC__ <= 3 ) ) - #warning "Older versions of GCC for Cygwin do not allow thread_local storage, so you can not use Loki::LevelMutex." - #undef COMPILER_ALLOWS_THREAD_LOCAL_STORAGE -#endif - -#if defined( COMPILER_ALLOWS_THREAD_LOCAL_STORAGE ) - - -#include "../include/loki/LevelMutex.h" - #if !defined( _MSC_VER ) #include <unistd.h> // needed for usleep function. #endif #include <algorithm> #include <cerrno> +#if defined( DEBUG ) || defined( _DEBUG ) + #define DEBUG_LOKI_LEVEL_MUTEX 1 + #include <iostream> +#endif - using namespace ::std; // define nullptr even though new compilers will have this keyword just so we @@ -806,6 +792,9 @@ switch ( result ) { case 0: +//#if defined( DEBUG_LOKI_LEVEL_MUTEX ) +// cout << __FUNCTION__ << '\t' << __LINE__ << endl; +//#endif return; case EBUSY: throw MutexException( "pthread mutex already initialized!", @@ -817,6 +806,18 @@ case EFAULT: throw MutexException( "pthread mutex has an invalid address!", level, MutexErrors::InvalidAddress ); + case ENOMEM: + throw MutexException( + "System does not have enough memory to initialize a pthread mutex.", + level, MutexErrors::NotEnoughMemory ); + case EPERM: + throw MutexException( + "Program does not have privilege to initialize a pthread mutex.", + level, MutexErrors::NotPrivileged ); + case EAGAIN: + throw MutexException( + "Program does not have resources to initialize another pthread mutex.", + level, MutexErrors::NotEnoughResources ); } #endif } @@ -830,6 +831,9 @@ #if defined( _MSC_VER ) ::DeleteCriticalSection( &m_mutex ); #else +//#if defined( DEBUG_LOKI_LEVEL_MUTEX ) +// cout << __FUNCTION__ << '\t' << __LINE__ << endl; +//#endif ::pthread_mutex_destroy( &m_mutex ); #endif } @@ -853,17 +857,29 @@ switch ( result ) { case 0: +//#if defined( DEBUG_LOKI_LEVEL_MUTEX ) +// cout << __FUNCTION__ << '\t' << __LINE__ << endl; +//#endif break; default: case EINVAL: - throw MutexException( "pthread mutex not initialized properly!", - GetLevel(), MutexErrors::NotInitialized ); + throw MutexException( "pthread mutex locked by thread with lower priority!", + GetLevel(), MutexErrors::InvertedPriority ); case EFAULT : throw MutexException( "pthread mutex is not valid!", GetLevel(), MutexErrors::InvalidAddress ); case EDEADLK: throw MutexException( "locking this pthread mutex may cause a deadlock!", GetLevel(), MutexErrors::MayDeadlock ); + case EBUSY: + throw MutexException( "Mutex is already locked by this thread.", + GetLevel(), MutexErrors::AlreadyLocked ); + case EAGAIN: + throw MutexException( "Mutex already locked too many times by this thread.", + GetLevel(), MutexErrors::TooMuchRecursion ); + case EPERM: + throw MutexException( "This thread does not own the mutex.", + GetLevel(), MutexErrors::NotPrivileged ); } #endif return MutexErrors::Success; @@ -884,6 +900,9 @@ switch ( result ) { case 0: +//#if defined( DEBUG_LOKI_LEVEL_MUTEX ) +// cout << __FUNCTION__ << '\t' << __LINE__ << endl; +//#endif return MutexErrors::Success; default: case EBUSY: @@ -891,6 +910,9 @@ case EAGAIN: throw MutexException( "pthread mutex reached recursion limit!", GetLevel(), MutexErrors::TooMuchRecursion ); + case EINVAL: + throw MutexException( "pthread mutex locked by thread with lower priority!", + GetLevel(), MutexErrors::InvertedPriority ); } return MutexErrors::TryFailed; #endif @@ -910,6 +932,9 @@ if ( EPERM == result ) throw MutexException( "current thread did not lock this pthread mutex!", GetLevel(), MutexErrors::NotLockedByThread ); +//#if defined( DEBUG_LOKI_LEVEL_MUTEX ) +// cout << __FUNCTION__ << '\t' << __LINE__ << endl; +//#endif #endif return MutexErrors::Success; } @@ -1165,4 +1190,4 @@ } // end namespace Loki -#endif // #if defined( COMPILER_ALLOWS_THREAD_LOCAL_STORAGE ) +#endif // #if defined( LOKI_THREAD_LOCAL ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ric...@us...> - 2009-11-20 06:37:19
|
Revision: 1057 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=1057&view=rev Author: rich_sposato Date: 2009-11-20 06:37:12 +0000 (Fri, 20 Nov 2009) Log Message: ----------- Added project to test if compiler implements thread_local correctly. Modified Paths: -------------- trunk/Loki.workspace trunk/Loki_MSVC_9.sln Modified: trunk/Loki.workspace =================================================================== --- trunk/Loki.workspace 2009-11-20 06:35:29 UTC (rev 1056) +++ trunk/Loki.workspace 2009-11-20 06:37:12 UTC (rev 1057) @@ -42,5 +42,6 @@ </Project> <Project filename="test\Visitor\Visitor.cbp" /> <Project filename="test\SafeBits\SafeBits.cbp" /> + <Project filename="test\ThreadLocal\ThreadLocal.cbp" /> </Workspace> </CodeBlocks_workspace_file> Modified: trunk/Loki_MSVC_9.sln =================================================================== --- trunk/Loki_MSVC_9.sln 2009-11-20 06:35:29 UTC (rev 1056) +++ trunk/Loki_MSVC_9.sln 2009-11-20 06:37:12 UTC (rev 1057) @@ -67,6 +67,8 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SafeBits", "test\SafeBits\SafeBits_MSVC_9.vcproj", "{ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ThreadLocal", "test\ThreadLocal\ThreadLocal.vcproj", "{27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -212,6 +214,12 @@ {ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}.Release_MultiThreaded|Win32.Build.0 = Release|Win32 {ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}.Release|Win32.ActiveCfg = Release|Win32 {ECD7ED50-B99D-44BE-BA38-E17D6110C3E5}.Release|Win32.Build.0 = Release|Win32 + {27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}.Debug|Win32.ActiveCfg = Debug|Win32 + {27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}.Debug|Win32.Build.0 = Debug|Win32 + {27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}.Release_MultiThreaded|Win32.ActiveCfg = Release|Win32 + {27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}.Release_MultiThreaded|Win32.Build.0 = Release|Win32 + {27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}.Release|Win32.ActiveCfg = Release|Win32 + {27CB0BB1-1754-46AB-A8C6-697D1B9B9C41}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <syn...@us...> - 2009-11-21 10:44:18
|
Revision: 1060 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=1060&view=rev Author: syntheticpp Date: 2009-11-21 10:44:08 +0000 (Sat, 21 Nov 2009) Log Message: ----------- use foreach in register code, add foreach tests Modified Paths: -------------- trunk/include/loki/Register.h trunk/include/loki/StrongPtr.h trunk/test/Register/classlist.h trunk/test/Register/foo.cpp trunk/test/Register/main.cpp Modified: trunk/include/loki/Register.h =================================================================== --- trunk/include/loki/Register.h 2009-11-21 10:40:59 UTC (rev 1059) +++ trunk/include/loki/Register.h 2009-11-21 10:44:08 UTC (rev 1060) @@ -17,7 +17,9 @@ #include "TypeManip.h" #include "HierarchyGenerators.h" +#include "ForEachType.h" + /// \defgroup RegisterGroup Register namespace Loki @@ -33,41 +35,39 @@ /// \ingroup RegisterGroup /// Must be specialized be the user //////////////////////////////////////////////////////////////////////////////// - template<class t> bool RegisterFunction(); + template<class T> + bool RegisterFunction(); //////////////////////////////////////////////////////////////////////////////// /// \ingroup RegisterGroup /// Must be specialized be the user //////////////////////////////////////////////////////////////////////////////// - template<class t> bool UnRegisterFunction(); + template<class T> + bool UnRegisterFunction(); namespace Private { - template<class T> struct RegisterOnCreate { - RegisterOnCreate() { RegisterFunction<T>(); } + template< int Index, typename T > + void operator()() + { + RegisterFunction<T>(); + } }; - template<class T> struct UnRegisterOnDelete { - ~UnRegisterOnDelete() { UnRegisterFunction<T>(); } - }; - - template<class T> - struct RegisterOnCreateElement - { - RegisterOnCreate<T> registerObj; + template< int Index, typename T > + void operator()() + { + UnRegisterFunction<T>(); + } }; - template<class T> - struct UnRegisterOnDeleteElement - { - UnRegisterOnDelete<T> unregisterObj; - }; } + //////////////////////////////////////////////////////////////////////////////// /// \class RegisterOnCreateSet /// @@ -79,9 +79,14 @@ //////////////////////////////////////////////////////////////////////////////// template<typename ElementList> - struct RegisterOnCreateSet - : GenScatterHierarchy<ElementList, Private::RegisterOnCreateElement> - {}; + struct RegisterOnCreateSet + { + RegisterOnCreateSet() + { + Private::RegisterOnCreate d; + ForEachType< ElementList, Private::RegisterOnCreate > dummy(d); + } + }; //////////////////////////////////////////////////////////////////////////////// /// \class UnRegisterOnDeleteSet @@ -93,9 +98,14 @@ /// see test/Register //////////////////////////////////////////////////////////////////////////////// template<typename ElementList> - struct UnRegisterOnDeleteSet - : GenScatterHierarchy<ElementList, Private::UnRegisterOnDeleteElement> - {}; + struct UnRegisterOnDeleteSet + { + ~UnRegisterOnDeleteSet() + { + Private::UnRegisterOnDelete d; + ForEachType< ElementList, Private::UnRegisterOnDelete > dummy(d); + } + }; //////////////////////////////////////////////////////////////////////////////// Modified: trunk/include/loki/StrongPtr.h =================================================================== --- trunk/include/loki/StrongPtr.h 2009-11-21 10:40:59 UTC (rev 1059) +++ trunk/include/loki/StrongPtr.h 2009-11-21 10:44:08 UTC (rev 1060) @@ -1810,4 +1810,3 @@ #endif // end file guardian - /// specialization of std::less for StroeTracker@Private@Loki@@@std@@@std@@QBEXABV123@@Z |