├── CMakeLists.txt ├── LICENSE.txt ├── README.md ├── README.valgrind ├── VERSION ├── googletest-release-1.7.0 ├── CHANGES ├── CMakeLists.txt ├── CONTRIBUTORS ├── LICENSE ├── Makefile.am ├── README ├── build-aux │ └── .keep ├── cmake │ └── internal_utils.cmake ├── codegear │ ├── gtest.cbproj │ ├── gtest.groupproj │ ├── gtest_all.cc │ ├── gtest_link.cc │ ├── gtest_main.cbproj │ └── gtest_unittest.cbproj ├── configure.ac ├── include │ └── gtest │ │ ├── gtest-death-test.h │ │ ├── gtest-message.h │ │ ├── gtest-param-test.h │ │ ├── gtest-param-test.h.pump │ │ ├── gtest-printers.h │ │ ├── gtest-spi.h │ │ ├── gtest-test-part.h │ │ ├── gtest-typed-test.h │ │ ├── gtest.h │ │ ├── gtest_pred_impl.h │ │ ├── gtest_prod.h │ │ └── internal │ │ ├── gtest-death-test-internal.h │ │ ├── gtest-filepath.h │ │ ├── gtest-internal.h │ │ ├── gtest-linked_ptr.h │ │ ├── gtest-param-util-generated.h │ │ ├── gtest-param-util-generated.h.pump │ │ ├── gtest-param-util.h │ │ ├── gtest-port.h │ │ ├── gtest-string.h │ │ ├── gtest-tuple.h │ │ ├── gtest-tuple.h.pump │ │ ├── gtest-type-util.h │ │ └── gtest-type-util.h.pump ├── m4 │ ├── acx_pthread.m4 │ └── gtest.m4 ├── make │ └── Makefile ├── msvc │ ├── gtest-md.sln │ ├── gtest-md.vcproj │ ├── gtest.sln │ ├── gtest.vcproj │ ├── gtest_main-md.vcproj │ ├── gtest_main.vcproj │ ├── gtest_prod_test-md.vcproj │ ├── gtest_prod_test.vcproj │ ├── gtest_unittest-md.vcproj │ └── gtest_unittest.vcproj ├── samples │ ├── prime_tables.h │ ├── sample1.cc │ ├── sample1.h │ ├── sample10_unittest.cc │ ├── sample1_unittest.cc │ ├── sample2.cc │ ├── sample2.h │ ├── sample2_unittest.cc │ ├── sample3-inl.h │ ├── sample3_unittest.cc │ ├── sample4.cc │ ├── sample4.h │ ├── sample4_unittest.cc │ ├── sample5_unittest.cc │ ├── sample6_unittest.cc │ ├── sample7_unittest.cc │ ├── sample8_unittest.cc │ └── sample9_unittest.cc ├── scripts │ ├── fuse_gtest_files.py │ ├── gen_gtest_pred_impl.py │ ├── gtest-config.in │ ├── pump.py │ ├── test │ │ └── Makefile │ ├── upload.py │ └── upload_gtest.py ├── src │ ├── gtest-all.cc │ ├── gtest-death-test.cc │ ├── gtest-filepath.cc │ ├── gtest-internal-inl.h │ ├── gtest-port.cc │ ├── gtest-printers.cc │ ├── gtest-test-part.cc │ ├── gtest-typed-test.cc │ ├── gtest.cc │ └── gtest_main.cc ├── test │ ├── gtest-death-test_ex_test.cc │ ├── gtest-death-test_test.cc │ ├── gtest-filepath_test.cc │ ├── gtest-linked_ptr_test.cc │ ├── gtest-listener_test.cc │ ├── gtest-message_test.cc │ ├── gtest-options_test.cc │ ├── gtest-param-test2_test.cc │ ├── gtest-param-test_test.cc │ ├── gtest-param-test_test.h │ ├── gtest-port_test.cc │ ├── gtest-printers_test.cc │ ├── gtest-test-part_test.cc │ ├── gtest-tuple_test.cc │ ├── gtest-typed-test2_test.cc │ ├── gtest-typed-test_test.cc │ ├── gtest-typed-test_test.h │ ├── gtest-unittest-api_test.cc │ ├── gtest_all_test.cc │ ├── gtest_break_on_failure_unittest.py │ ├── gtest_break_on_failure_unittest_.cc │ ├── gtest_catch_exceptions_test.py │ ├── gtest_catch_exceptions_test_.cc │ ├── gtest_color_test.py │ ├── gtest_color_test_.cc │ ├── gtest_env_var_test.py │ ├── gtest_env_var_test_.cc │ ├── gtest_environment_test.cc │ ├── gtest_filter_unittest.py │ ├── gtest_filter_unittest_.cc │ ├── gtest_help_test.py │ ├── gtest_help_test_.cc │ ├── gtest_list_tests_unittest.py │ ├── gtest_list_tests_unittest_.cc │ ├── gtest_main_unittest.cc │ ├── gtest_no_test_unittest.cc │ ├── gtest_output_test.py │ ├── gtest_output_test_.cc │ ├── gtest_output_test_golden_lin.txt │ ├── gtest_pred_impl_unittest.cc │ ├── gtest_premature_exit_test.cc │ ├── gtest_prod_test.cc │ ├── gtest_repeat_test.cc │ ├── gtest_shuffle_test.py │ ├── gtest_shuffle_test_.cc │ ├── gtest_sole_header_test.cc │ ├── gtest_stress_test.cc │ ├── gtest_test_utils.py │ ├── gtest_throw_on_failure_ex_test.cc │ ├── gtest_throw_on_failure_test.py │ ├── gtest_throw_on_failure_test_.cc │ ├── gtest_uninitialized_test.py │ ├── gtest_uninitialized_test_.cc │ ├── gtest_unittest.cc │ ├── gtest_xml_outfile1_test_.cc │ ├── gtest_xml_outfile2_test_.cc │ ├── gtest_xml_outfiles_test.py │ ├── gtest_xml_output_unittest.py │ ├── gtest_xml_output_unittest_.cc │ ├── gtest_xml_test_utils.py │ ├── production.cc │ └── production.h └── xcode │ ├── Config │ ├── DebugProject.xcconfig │ ├── FrameworkTarget.xcconfig │ ├── General.xcconfig │ ├── ReleaseProject.xcconfig │ ├── StaticLibraryTarget.xcconfig │ └── TestTarget.xcconfig │ ├── Resources │ └── Info.plist │ ├── Samples │ └── FrameworkSample │ │ ├── Info.plist │ │ ├── WidgetFramework.xcodeproj │ │ └── project.pbxproj │ │ ├── runtests.sh │ │ ├── widget.cc │ │ ├── widget.h │ │ └── widget_test.cc │ ├── Scripts │ ├── runtests.sh │ └── versiongenerate.py │ └── gtest.xcodeproj │ └── project.pbxproj ├── oadr ├── .gitignore └── oadr │ ├── helper │ ├── DateTimeConverter.cpp │ ├── DateTimeConverter.h │ ├── ISO8601Duration.cpp │ ├── ISO8601Duration.h │ ├── RandomHex.cpp │ ├── RandomHex.h │ ├── Timezone.cpp │ ├── Timezone.h │ ├── conditionalsleep │ │ ├── ConditionalSleep.cpp │ │ ├── ConditionalSleep.h │ │ ├── IConditionalSleep.cpp │ │ └── IConditionalSleep.h │ ├── globaltime │ │ ├── GlobalTime.cpp │ │ ├── GlobalTime.h │ │ ├── GlobalTimeStandard.cpp │ │ ├── GlobalTimeStandard.h │ │ ├── IGlobalTime.cpp │ │ └── IGlobalTime.h │ └── thread │ │ ├── IRun.cpp │ │ ├── IRun.h │ │ ├── ThreadRunner.cpp │ │ └── ThreadRunner.h │ ├── manager │ ├── IOADRExceptionService.cpp │ ├── IOADRExceptionService.h │ ├── IVENManager.cpp │ ├── IVENManager.h │ ├── VENManager.cpp │ ├── VENManager.h │ ├── VENManagerConfig.h │ ├── eventmanager │ │ ├── EventManager.cpp │ │ ├── EventManager.h │ │ ├── IEventService.cpp │ │ ├── IEventService.h │ │ ├── ISendCreatedEvent.cpp │ │ ├── ISendCreatedEvent.h │ │ └── job │ │ │ └── event │ │ │ ├── JobEventComplete.cpp │ │ │ ├── JobEventComplete.h │ │ │ ├── JobEventIntervalStart.cpp │ │ │ ├── JobEventIntervalStart.h │ │ │ ├── JobEventStart.cpp │ │ │ └── JobEventStart.h │ ├── reportmanager │ │ ├── IReportService.cpp │ │ ├── IReportService.h │ │ ├── ISendReport.cpp │ │ ├── ISendReport.h │ │ ├── RegisteredReports.cpp │ │ ├── RegisteredReports.h │ │ ├── ReportManager.cpp │ │ └── ReportManager.h │ └── transport │ │ ├── ITransport.cpp │ │ └── ITransport.h │ ├── request │ ├── CancelPartyRegistration.cpp │ ├── CancelPartyRegistration.h │ ├── CanceledReport.cpp │ ├── CanceledReport.h │ ├── CreatePartyRegistration.cpp │ ├── CreatePartyRegistration.h │ ├── CreatedEvent.cpp │ ├── CreatedEvent.h │ ├── CreatedReport.cpp │ ├── CreatedReport.h │ ├── DurationModifier.cpp │ ├── DurationModifier.h │ ├── Oadr2bHelper.cpp │ ├── Oadr2bHelper.h │ ├── Oadr2bRequest.cpp │ ├── Oadr2bRequest.h │ ├── OadrException.cpp │ ├── OadrException.h │ ├── Poll.cpp │ ├── Poll.h │ ├── QueryRegistration.cpp │ ├── QueryRegistration.h │ ├── RequestEvent.cpp │ ├── RequestEvent.h │ ├── opt │ │ ├── CancelOptSchedule.cpp │ │ ├── CancelOptSchedule.h │ │ ├── CreateOpt.cpp │ │ ├── CreateOpt.h │ │ ├── CreateOptEvent.cpp │ │ ├── CreateOptEvent.h │ │ ├── CreateOptSchedule.cpp │ │ ├── CreateOptSchedule.h │ │ ├── OptReasonValue.cpp │ │ ├── OptReasonValue.h │ │ ├── OptSchedule.cpp │ │ └── OptSchedule.h │ └── report │ │ ├── RegisterReport.cpp │ │ ├── RegisterReport.h │ │ ├── RegisteredReport.cpp │ │ ├── RegisteredReport.h │ │ ├── ReportHelper.cpp │ │ ├── ReportHelper.h │ │ ├── ReportName.cpp │ │ ├── ReportName.h │ │ ├── UpdateReport.cpp │ │ └── UpdateReport.h │ ├── scheduler │ ├── IJob.cpp │ ├── IJob.h │ ├── IScheduler.cpp │ ├── IScheduler.h │ ├── JobLambda.cpp │ ├── JobLambda.h │ ├── Scheduler.cpp │ ├── Scheduler.h │ ├── SchedulerJob.cpp │ ├── SchedulerJob.h │ ├── SchedulerJobs.cpp │ └── SchedulerJobs.h │ └── ven │ ├── IOadrMessage.cpp │ ├── IOadrMessage.h │ ├── VEN2b.cpp │ ├── VEN2b.h │ └── http │ ├── CurlBuffer.cpp │ ├── CurlBuffer.h │ ├── CurlException.cpp │ ├── CurlException.h │ ├── CurlReceiveBuffer.cpp │ ├── CurlReceiveBuffer.h │ ├── CurlSendBuffer.cpp │ ├── CurlSendBuffer.h │ ├── HttpCurl.cpp │ ├── HttpCurl.h │ ├── IHttp.cpp │ └── IHttp.h ├── oadrsd ├── .gitignore ├── SConscript └── oadrsd │ ├── 2b │ ├── AccuracyType.cxx │ ├── AccuracyType.hxx │ ├── AggregatedPnodeType.cxx │ ├── AggregatedPnodeType.hxx │ ├── ArrayOfVavailabilityContainedComponents.cxx │ ├── ArrayOfVavailabilityContainedComponents.hxx │ ├── ArrayofResponses.cxx │ ├── ArrayofResponses.hxx │ ├── AvailableType.cxx │ ├── AvailableType.hxx │ ├── BaseUnitType.cxx │ ├── BaseUnitType.hxx │ ├── CanonicalizationMethodType.cxx │ ├── CanonicalizationMethodType.hxx │ ├── CharTwoFieldParamsType.cxx │ ├── CharTwoFieldParamsType.hxx │ ├── ConfidenceType.cxx │ ├── ConfidenceType.hxx │ ├── CryptoBinary.cxx │ ├── CryptoBinary.hxx │ ├── CurrentType.cxx │ ├── CurrentType.hxx │ ├── CurveType.cxx │ ├── CurveType.hxx │ ├── DEREncodedKeyValueType.cxx │ ├── DEREncodedKeyValueType.hxx │ ├── DSAKeyValueType.cxx │ ├── DSAKeyValueType.hxx │ ├── DateTimeType.cxx │ ├── DateTimeType.hxx │ ├── DigestMethodType.cxx │ ├── DigestMethodType.hxx │ ├── DigestValueType.cxx │ ├── DigestValueType.hxx │ ├── DurationPropType.cxx │ ├── DurationPropType.hxx │ ├── DurationValueType.cxx │ ├── DurationValueType.hxx │ ├── ECKeyValueType.cxx │ ├── ECKeyValueType.hxx │ ├── ECParametersType.cxx │ ├── ECParametersType.hxx │ ├── ECPointType.cxx │ ├── ECPointType.hxx │ ├── ECValidationDataType.cxx │ ├── ECValidationDataType.hxx │ ├── EiExtensionTokenType.cxx │ ├── EiExtensionTokenType.hxx │ ├── EiOptType.cxx │ ├── EiOptType.hxx │ ├── EiResponseType.cxx │ ├── EiResponseType.hxx │ ├── EiTargetType.cxx │ ├── EiTargetType.hxx │ ├── EndDeviceAssetType.cxx │ ├── EndDeviceAssetType.hxx │ ├── EnergyApparentType.cxx │ ├── EnergyApparentType.hxx │ ├── EnergyItemType.cxx │ ├── EnergyItemType.hxx │ ├── EnergyReactiveType.cxx │ ├── EnergyReactiveType.hxx │ ├── EnergyRealType.cxx │ ├── EnergyRealType.hxx │ ├── EventStatusEnumeratedType.cxx │ ├── EventStatusEnumeratedType.hxx │ ├── FeatureCollection.cxx │ ├── FeatureCollection.hxx │ ├── FieldIDType.cxx │ ├── FieldIDType.hxx │ ├── FrequencyType.cxx │ ├── FrequencyType.hxx │ ├── HMACOutputLengthType.cxx │ ├── HMACOutputLengthType.hxx │ ├── ISO3AlphaCurrencyCodeContentType.cxx │ ├── ISO3AlphaCurrencyCodeContentType.hxx │ ├── IntervalType.cxx │ ├── IntervalType.hxx │ ├── ItemBaseType.cxx │ ├── ItemBaseType.hxx │ ├── KeyInfoReferenceType.cxx │ ├── KeyInfoReferenceType.hxx │ ├── KeyInfoType.cxx │ ├── KeyInfoType.hxx │ ├── KeyValueType.cxx │ ├── KeyValueType.hxx │ ├── LinearRing.cxx │ ├── LinearRing.hxx │ ├── ManifestType.cxx │ ├── ManifestType.hxx │ ├── MarketContextType.cxx │ ├── MarketContextType.hxx │ ├── MeterAssetType.cxx │ ├── MeterAssetType.hxx │ ├── MridType.cxx │ ├── MridType.hxx │ ├── NamedCurveType.cxx │ ├── NamedCurveType.hxx │ ├── NodeType.cxx │ ├── NodeType.hxx │ ├── ObjectType.cxx │ ├── ObjectType.hxx │ ├── OptReasonEnumeratedType.cxx │ ├── OptReasonEnumeratedType.hxx │ ├── OptReasonType.cxx │ ├── OptReasonType.hxx │ ├── OptTypeType.cxx │ ├── OptTypeType.hxx │ ├── PGPDataType.cxx │ ├── PGPDataType.hxx │ ├── PayloadBaseType.cxx │ ├── PayloadBaseType.hxx │ ├── PayloadFloatType.cxx │ ├── PayloadFloatType.hxx │ ├── PnBFieldParamsType.cxx │ ├── PnBFieldParamsType.hxx │ ├── PnodeType.cxx │ ├── PnodeType.hxx │ ├── Polygon.cxx │ ├── Polygon.hxx │ ├── PowerApparentType.cxx │ ├── PowerApparentType.hxx │ ├── PowerAttributesType.cxx │ ├── PowerAttributesType.hxx │ ├── PowerItemType.cxx │ ├── PowerItemType.hxx │ ├── PowerReactiveType.cxx │ ├── PowerReactiveType.hxx │ ├── PowerRealType.cxx │ ├── PowerRealType.hxx │ ├── PrimeFieldParamsType.cxx │ ├── PrimeFieldParamsType.hxx │ ├── QualifiedEventIDType.cxx │ ├── QualifiedEventIDType.hxx │ ├── RSAKeyValueType.cxx │ ├── RSAKeyValueType.hxx │ ├── ReadingTypeEnumeratedType.cxx │ ├── ReadingTypeEnumeratedType.hxx │ ├── ReadingTypeType.cxx │ ├── ReadingTypeType.hxx │ ├── ReferenceType.cxx │ ├── ReferenceType.hxx │ ├── ReportEnumeratedType.cxx │ ├── ReportEnumeratedType.hxx │ ├── ReportPayloadType.cxx │ ├── ReportPayloadType.hxx │ ├── ReportSpecifierType.cxx │ ├── ReportSpecifierType.hxx │ ├── ReportTypeType.cxx │ ├── ReportTypeType.hxx │ ├── ResponseCodeType.cxx │ ├── ResponseCodeType.hxx │ ├── ResponseRequiredType.cxx │ ├── ResponseRequiredType.hxx │ ├── RetrievalMethodType.cxx │ ├── RetrievalMethodType.hxx │ ├── SPKIDataType.cxx │ ├── SPKIDataType.hxx │ ├── ServiceAreaType.cxx │ ├── ServiceAreaType.hxx │ ├── ServiceDeliveryPointType.cxx │ ├── ServiceDeliveryPointType.hxx │ ├── ServiceLocationType.cxx │ ├── ServiceLocationType.hxx │ ├── SiScaleCodeType.cxx │ ├── SiScaleCodeType.hxx │ ├── SignalNameEnumeratedType.cxx │ ├── SignalNameEnumeratedType.hxx │ ├── SignalTypeEnumeratedType.cxx │ ├── SignalTypeEnumeratedType.hxx │ ├── SignatureMethodType.cxx │ ├── SignatureMethodType.hxx │ ├── SignaturePropertiesType.cxx │ ├── SignaturePropertiesType.hxx │ ├── SignaturePropertyType.cxx │ ├── SignaturePropertyType.hxx │ ├── SignatureType.cxx │ ├── SignatureType.hxx │ ├── SignatureValueType.cxx │ ├── SignatureValueType.hxx │ ├── SignedInfoType.cxx │ ├── SignedInfoType.hxx │ ├── SpecifierPayloadType.cxx │ ├── SpecifierPayloadType.hxx │ ├── StreamBaseType.cxx │ ├── StreamBaseType.hxx │ ├── StreamPayloadBaseType.cxx │ ├── StreamPayloadBaseType.hxx │ ├── ThermType.cxx │ ├── ThermType.hxx │ ├── TnBFieldParamsType.cxx │ ├── TnBFieldParamsType.hxx │ ├── TransformType.cxx │ ├── TransformType.hxx │ ├── TransformsType.cxx │ ├── TransformsType.hxx │ ├── TransportInterfaceType.cxx │ ├── TransportInterfaceType.hxx │ ├── UidType.cxx │ ├── UidType.hxx │ ├── VavailabilityType.cxx │ ├── VavailabilityType.hxx │ ├── VoltageType.cxx │ ├── VoltageType.hxx │ ├── WsCalendarIntervalType.cxx │ ├── WsCalendarIntervalType.hxx │ ├── X509DataType.cxx │ ├── X509DataType.hxx │ ├── X509DigestType.cxx │ ├── X509DigestType.hxx │ ├── X509IssuerSerialType.cxx │ ├── X509IssuerSerialType.hxx │ ├── categoryType.cxx │ ├── categoryType.hxx │ ├── contentType.cxx │ ├── contentType.hxx │ ├── currencyItemDescriptionType.cxx │ ├── currencyItemDescriptionType.hxx │ ├── currencyType.cxx │ ├── currencyType.hxx │ ├── currentValueType.cxx │ ├── currentValueType.hxx │ ├── dateTimeType1.cxx │ ├── dateTimeType1.hxx │ ├── doubleList.cxx │ ├── doubleList.hxx │ ├── dtend.cxx │ ├── dtend.hxx │ ├── dtstart.cxx │ ├── dtstart.hxx │ ├── eiActivePeriodType.cxx │ ├── eiActivePeriodType.hxx │ ├── eiCreatedEvent.cxx │ ├── eiCreatedEvent.hxx │ ├── eiEventBaselineType.cxx │ ├── eiEventBaselineType.hxx │ ├── eiEventSignalType.cxx │ ├── eiEventSignalType.hxx │ ├── eiEventSignalsType.cxx │ ├── eiEventSignalsType.hxx │ ├── eiEventType.cxx │ ├── eiEventType.hxx │ ├── eiMarketContext.cxx │ ├── eiMarketContext.hxx │ ├── eiRequestEvent.cxx │ ├── eiRequestEvent.hxx │ ├── emailType.cxx │ ├── emailType.hxx │ ├── entryType.cxx │ ├── entryType.hxx │ ├── eventDescriptorType.cxx │ ├── eventDescriptorType.hxx │ ├── eventResponse.cxx │ ├── eventResponse.hxx │ ├── eventResponses.cxx │ ├── eventResponses.hxx │ ├── exterior.cxx │ ├── exterior.hxx │ ├── feedType.cxx │ ├── feedType.hxx │ ├── generatorType.cxx │ ├── generatorType.hxx │ ├── iconType.cxx │ ├── iconType.hxx │ ├── idType.cxx │ ├── idType.hxx │ ├── intervals.cxx │ ├── intervals.hxx │ ├── linkType.cxx │ ├── linkType.hxx │ ├── location.cxx │ ├── location.hxx │ ├── logoType.cxx │ ├── logoType.hxx │ ├── oadrCancelOptType.cxx │ ├── oadrCancelOptType.hxx │ ├── oadrCancelPartyRegistrationType.cxx │ ├── oadrCancelPartyRegistrationType.hxx │ ├── oadrCancelReportType.cxx │ ├── oadrCancelReportType.hxx │ ├── oadrCanceledOptType.cxx │ ├── oadrCanceledOptType.hxx │ ├── oadrCanceledPartyRegistrationType.cxx │ ├── oadrCanceledPartyRegistrationType.hxx │ ├── oadrCanceledReportType.cxx │ ├── oadrCanceledReportType.hxx │ ├── oadrCreateOptType.cxx │ ├── oadrCreateOptType.hxx │ ├── oadrCreatePartyRegistrationType.cxx │ ├── oadrCreatePartyRegistrationType.hxx │ ├── oadrCreateReportType.cxx │ ├── oadrCreateReportType.hxx │ ├── oadrCreatedEventType.cxx │ ├── oadrCreatedEventType.hxx │ ├── oadrCreatedOptType.cxx │ ├── oadrCreatedOptType.hxx │ ├── oadrCreatedPartyRegistrationType.cxx │ ├── oadrCreatedPartyRegistrationType.hxx │ ├── oadrCreatedReportType.cxx │ ├── oadrCreatedReportType.hxx │ ├── oadrDataQualityType.cxx │ ├── oadrDataQualityType.hxx │ ├── oadrDataQualityTypeType.cxx │ ├── oadrDataQualityTypeType.hxx │ ├── oadrDistributeEventType.cxx │ ├── oadrDistributeEventType.hxx │ ├── oadrEvent.cxx │ ├── oadrEvent.hxx │ ├── oadrExtension.cxx │ ├── oadrExtension.hxx │ ├── oadrExtensions.cxx │ ├── oadrExtensions.hxx │ ├── oadrGBItemBase.cxx │ ├── oadrGBItemBase.hxx │ ├── oadrGBStreamPayloadBase.cxx │ ├── oadrGBStreamPayloadBase.hxx │ ├── oadrInfo.cxx │ ├── oadrInfo.hxx │ ├── oadrLoadControlStateType.cxx │ ├── oadrLoadControlStateType.hxx │ ├── oadrLoadControlStateTypeType.cxx │ ├── oadrLoadControlStateTypeType.hxx │ ├── oadrPayload.cxx │ ├── oadrPayload.hxx │ ├── oadrPayloadResourceStatusType.cxx │ ├── oadrPayloadResourceStatusType.hxx │ ├── oadrPendingReportsType.cxx │ ├── oadrPendingReportsType.hxx │ ├── oadrPollType.cxx │ ├── oadrPollType.hxx │ ├── oadrProfile.cxx │ ├── oadrProfile.hxx │ ├── oadrProfileType.cxx │ ├── oadrProfileType.hxx │ ├── oadrProfiles.cxx │ ├── oadrProfiles.hxx │ ├── oadrQueryRegistrationType.cxx │ ├── oadrQueryRegistrationType.hxx │ ├── oadrRegisterReportType.cxx │ ├── oadrRegisterReportType.hxx │ ├── oadrRegisteredReportType.cxx │ ├── oadrRegisteredReportType.hxx │ ├── oadrReportDescriptionType.cxx │ ├── oadrReportDescriptionType.hxx │ ├── oadrReportPayloadType.cxx │ ├── oadrReportPayloadType.hxx │ ├── oadrReportRequestType.cxx │ ├── oadrReportRequestType.hxx │ ├── oadrReportType.cxx │ ├── oadrReportType.hxx │ ├── oadrRequestEventType.cxx │ ├── oadrRequestEventType.hxx │ ├── oadrRequestReregistrationType.cxx │ ├── oadrRequestReregistrationType.hxx │ ├── oadrResponseType.cxx │ ├── oadrResponseType.hxx │ ├── oadrSamplingRateType.cxx │ ├── oadrSamplingRateType.hxx │ ├── oadrService.cxx │ ├── oadrService.hxx │ ├── oadrServiceNameType.cxx │ ├── oadrServiceNameType.hxx │ ├── oadrServiceSpecificInfo.cxx │ ├── oadrServiceSpecificInfo.hxx │ ├── oadrSignedObject.cxx │ ├── oadrSignedObject.hxx │ ├── oadrTransport.cxx │ ├── oadrTransport.hxx │ ├── oadrTransportType.cxx │ ├── oadrTransportType.hxx │ ├── oadrTransports.cxx │ ├── oadrTransports.hxx │ ├── oadrUpdateReportType.cxx │ ├── oadrUpdateReportType.hxx │ ├── oadrUpdatedReportType.cxx │ ├── oadrUpdatedReportType.hxx │ ├── oadr_20b.cxx │ ├── oadr_20b.hxx │ ├── oadr_ISO_ISO3AlphaCurrencyCode_20100407.cxx │ ├── oadr_ISO_ISO3AlphaCurrencyCode_20100407.hxx │ ├── oadr_atom.cxx │ ├── oadr_atom.hxx │ ├── oadr_ei_20b.cxx │ ├── oadr_ei_20b.hxx │ ├── oadr_emix_20b.cxx │ ├── oadr_emix_20b.hxx │ ├── oadr_gml_20b.cxx │ ├── oadr_gml_20b.hxx │ ├── oadr_power_20b.cxx │ ├── oadr_power_20b.hxx │ ├── oadr_pyld_20b.cxx │ ├── oadr_pyld_20b.hxx │ ├── oadr_siscale_20b.cxx │ ├── oadr_siscale_20b.hxx │ ├── oadr_strm_20b.cxx │ ├── oadr_strm_20b.hxx │ ├── oadr_xcal_20b.cxx │ ├── oadr_xcal_20b.hxx │ ├── oadr_xml.cxx │ ├── oadr_xml.hxx │ ├── oadr_xmldsig.cxx │ ├── oadr_xmldsig.hxx │ ├── oadr_xmldsig11.cxx │ ├── oadr_xmldsig11.hxx │ ├── personType.cxx │ ├── personType.hxx │ ├── properties.cxx │ ├── properties.hxx │ ├── pulseCountType.cxx │ ├── pulseCountType.hxx │ ├── reportNameEnumeratedType.cxx │ ├── reportNameEnumeratedType.hxx │ ├── reportNameType.cxx │ ├── reportNameType.hxx │ ├── schemaVersionEnumeratedType.cxx │ ├── schemaVersionEnumeratedType.hxx │ ├── schemaVersionType.cxx │ ├── schemaVersionType.hxx │ ├── signalNameType.cxx │ ├── signalNameType.hxx │ ├── signalPayloadType.cxx │ ├── signalPayloadType.hxx │ ├── sourceType.cxx │ ├── sourceType.hxx │ ├── space.cxx │ ├── space.hxx │ ├── temperatureType.cxx │ ├── temperatureType.hxx │ ├── temperatureUnitType.cxx │ ├── temperatureUnitType.hxx │ ├── textType.cxx │ ├── textType.hxx │ ├── tolerance.cxx │ ├── tolerance.hxx │ ├── tolerate.cxx │ ├── tolerate.hxx │ ├── type.cxx │ ├── type.hxx │ ├── uid.cxx │ ├── uid.hxx │ ├── uriType.cxx │ └── uriType.hxx │ └── schema │ ├── build.sh │ ├── oadr_20b.xsd │ ├── oadr_ISO_ISO3AlphaCurrencyCode_20100407.xsd │ ├── oadr_atom.xsd │ ├── oadr_ei_20b.xsd │ ├── oadr_emix_20b.xsd │ ├── oadr_gml_20b.xsd │ ├── oadr_greenbutton.xsd │ ├── oadr_power_20b.xsd │ ├── oadr_pyld_20b.xsd │ ├── oadr_siscale_20b.xsd │ ├── oadr_strm_20b.xsd │ ├── oadr_xcal_20b.xsd │ ├── oadr_xml.xsd │ ├── oadr_xmldsig-properties-schema.xsd │ ├── oadr_xmldsig.xsd │ └── oadr_xmldsig11.xsd ├── oadrtest ├── .gitignore └── oadrtest │ ├── conf │ └── 000-default.conf │ ├── expected_output │ ├── RegisterReport_XMLOutput1.xml │ ├── UpdateReport_XMLOutput1.xml │ ├── create_opt_schedule1.xml │ ├── currency_actual.xml │ ├── currency_per_kw_actual.xml │ ├── currency_per_kwh.xml │ ├── currency_per_kwh_actual.xml │ ├── register_report1.xml │ ├── request_event1.xml │ ├── update_report1.xml │ └── update_report2.xml │ ├── helper │ ├── LoadFile.cpp │ ├── LoadFile.h │ ├── MockGlobalIncrementingTime.cpp │ ├── MockGlobalIncrementingTime.h │ ├── MockGlobalTime.cpp │ ├── MockGlobalTime.h │ ├── MockScheduler.cpp │ └── MockScheduler.h │ ├── main.cpp │ ├── test_input │ ├── created_party_registration-invalid-ven-name.xml │ ├── created_party_registration.xml │ ├── currency.xml │ ├── currency1.xml │ ├── currency_per_kw.xml │ ├── currency_per_kw1.xml │ ├── currency_per_kwh.xml │ ├── payload │ │ ├── cancel_report-no-report_to_follow.xml │ │ ├── cancel_report-w-report_to_follow.xml │ │ ├── create_report-oneshot.xml │ │ ├── create_report-oneshot_invalid.xml │ │ ├── create_report-periodic-zero-duration.xml │ │ ├── create_report-periodic.xml │ │ ├── distribute_event_1event2signals.xml │ │ ├── distribute_event_active.xml │ │ └── registered_reports_1.xml │ ├── test_buffer1.txt │ ├── test_buffer2.txt │ └── test_parser1.xml │ └── tests │ ├── CurlHTTPTest.cpp │ ├── CurlReceiveBufferTest.cpp │ ├── CurrencyTest.cpp │ ├── Oadr2bHelperTest.cpp │ ├── ParserTest.cpp │ ├── VEN2bTestSetTest.cpp │ ├── XMLOutputTest.cpp │ ├── eventmanager │ ├── BlankEventService.cpp │ ├── BlankEventService.h │ ├── BlankSendCreatedEvent.cpp │ ├── BlankSendCreatedEvent.h │ ├── CreateEventHelper.cpp │ ├── CreateEventHelper.h │ └── EventManagerTest.cpp │ ├── helper │ ├── DateTimeConverterTest.cpp │ ├── ISO8601DurationTest.cpp │ ├── ReportHelperTest.cpp │ └── TimeZoneTest.cpp │ ├── reportmanager │ ├── BlankReportService.cpp │ ├── BlankReportService.h │ ├── BlankSendReport.cpp │ ├── BlankSendReport.h │ ├── RegisteredReportsTest.cpp │ └── ReportManagerTest.cpp │ ├── scheduler │ ├── JobException.cpp │ ├── JobException.h │ ├── JobNull.cpp │ ├── JobNull.h │ ├── JobSlow.cpp │ ├── JobSlow.h │ ├── MockConditionalSleep.cpp │ ├── MockConditionalSleep.h │ ├── SchedulerJobTest.cpp │ └── SchedulerTest.cpp │ └── ven │ ├── MockHttp.cpp │ ├── MockHttp.h │ └── VenTest.cpp ├── samplevenmanager └── samplevenmanager │ ├── VENImpl.cpp │ ├── VENImpl.h │ ├── easylogging++.h │ └── main.cpp └── xsd-4.0.0 ├── FLOSSE ├── GPLv2 ├── LICENSE ├── README └── xsd └── cxx ├── auto-array.hxx ├── compilers └── vc-8 │ ├── post.hxx │ └── pre.hxx ├── config.hxx ├── exceptions.hxx ├── parser ├── document.hxx ├── document.txx ├── elements.hxx ├── elements.txx ├── error-handler.hxx ├── error-handler.txx ├── exceptions.hxx ├── exceptions.ixx ├── exceptions.txx ├── expat │ ├── elements.hxx │ └── elements.txx ├── map.hxx ├── map.ixx ├── map.txx ├── non-validating │ ├── parser.hxx │ ├── parser.txx │ ├── xml-schema-pimpl.hxx │ ├── xml-schema-pimpl.ixx │ ├── xml-schema-pimpl.txx │ ├── xml-schema-pskel.hxx │ ├── xml-schema-pskel.ixx │ └── xml-schema-pskel.txx ├── schema-exceptions.hxx ├── schema-exceptions.ixx ├── schema-exceptions.txx ├── substitution-map.hxx ├── substitution-map.txx ├── validating │ ├── exceptions.hxx │ ├── exceptions.ixx │ ├── exceptions.txx │ ├── inheritance-map.hxx │ ├── inheritance-map.txx │ ├── parser.hxx │ ├── parser.txx │ ├── xml-schema-pimpl.hxx │ ├── xml-schema-pimpl.ixx │ ├── xml-schema-pimpl.txx │ ├── xml-schema-pskel.hxx │ ├── xml-schema-pskel.ixx │ └── xml-schema-pskel.txx ├── xerces │ ├── elements.hxx │ └── elements.txx ├── xml-schema.hxx ├── xml-schema.ixx └── xml-schema.txx ├── post.hxx ├── pre.hxx ├── ro-string.hxx ├── ro-string.txx ├── tree ├── ace-cdr-stream-common.hxx ├── ace-cdr-stream-extraction.hxx ├── ace-cdr-stream-insertion.hxx ├── bits │ ├── literals.hxx │ └── literals.ixx ├── buffer.hxx ├── buffer.txx ├── comparison-map.hxx ├── comparison-map.txx ├── containers-wildcard.hxx ├── containers.hxx ├── containers.txx ├── date-time-extraction.txx ├── date-time-insertion.txx ├── date-time-ostream.txx ├── date-time.hxx ├── date-time.ixx ├── date-time.txx ├── element-map.hxx ├── element-map.txx ├── elements.hxx ├── elements.ixx ├── elements.txx ├── error-handler.hxx ├── error-handler.txx ├── exceptions.hxx ├── exceptions.txx ├── facet.hxx ├── istream-fwd.hxx ├── istream.hxx ├── iterator-adapter.hxx ├── list.hxx ├── ostream.hxx ├── parsing.hxx ├── parsing.txx ├── parsing │ ├── boolean.hxx │ ├── byte.hxx │ ├── date-time.txx │ ├── decimal.hxx │ ├── double.hxx │ ├── element-map.txx │ ├── float.hxx │ ├── int.hxx │ ├── long.hxx │ ├── short.hxx │ ├── unsigned-byte.hxx │ ├── unsigned-int.hxx │ ├── unsigned-long.hxx │ └── unsigned-short.hxx ├── serialization.hxx ├── serialization.txx ├── serialization │ ├── boolean.hxx │ ├── byte.hxx │ ├── date-time.txx │ ├── decimal.hxx │ ├── double.hxx │ ├── element-map.txx │ ├── float.hxx │ ├── int.hxx │ ├── long.hxx │ ├── short.hxx │ ├── unsigned-byte.hxx │ ├── unsigned-int.hxx │ ├── unsigned-long.hxx │ └── unsigned-short.hxx ├── std-ostream-map.hxx ├── std-ostream-map.txx ├── std-ostream-operators.hxx ├── stream-extraction-map.hxx ├── stream-extraction-map.txx ├── stream-extraction.hxx ├── stream-insertion-map.hxx ├── stream-insertion-map.txx ├── stream-insertion.hxx ├── text.hxx ├── text.txx ├── type-factory-map.hxx ├── type-factory-map.txx ├── type-serializer-map.hxx ├── type-serializer-map.txx ├── types.hxx ├── types.txx ├── xdr-stream-common.hxx ├── xdr-stream-extraction.hxx └── xdr-stream-insertion.hxx ├── version.hxx ├── xml ├── bits │ ├── literals.hxx │ └── literals.ixx ├── char-iso8859-1.hxx ├── char-iso8859-1.txx ├── char-lcp.hxx ├── char-lcp.txx ├── char-utf8.hxx ├── char-utf8.txx ├── dom │ ├── auto-ptr.hxx │ ├── bits │ │ ├── error-handler-proxy.hxx │ │ └── error-handler-proxy.txx │ ├── elements.hxx │ ├── elements.txx │ ├── parsing-header.hxx │ ├── parsing-source.hxx │ ├── parsing-source.txx │ ├── serialization-header.hxx │ ├── serialization-header.txx │ ├── serialization-source.hxx │ ├── serialization-source.txx │ ├── wildcard-source.hxx │ └── wildcard-source.txx ├── elements.hxx ├── elements.txx ├── error-handler.hxx ├── exceptions.hxx ├── qualified-name.hxx ├── sax │ ├── bits │ │ ├── error-handler-proxy.hxx │ │ └── error-handler-proxy.txx │ └── std-input-source.hxx ├── std-memory-manager.hxx ├── string.hxx ├── string.ixx └── string.txx ├── zc-istream.hxx └── zc-istream.txx /README.md: -------------------------------------------------------------------------------- 1 | # Intro 2 | Copyright (c) 2016, Electric Power Research Institute (EPRI) 3 | 4 | This project (OADRLIB) provides a basis for implementing an OpenADR2.0b VEN. Http pull is the only supported transport. 5 | 6 | # Dependencies 7 | The library has the following dependencies: 8 | * GTest (unit testing, source is inlcuded) 9 | * code synthesis XSD 4.0.0 (included in the project) 10 | * curl (http/s communication) + any curl supported SSL library 11 | 12 | Follow the instructions for your operating system to install `curl` and a curl 13 | supported SSL library. 14 | 15 | The library is built and tested on Ubuntu Linux 16.04. 16 | 17 | # Build Instructions 18 | OADRLIB uses cmake. Here are general instructions for starting the build: 19 | ``` 20 | mkdir -p build/debug 21 | cmake ../../ 22 | make 23 | ``` 24 | 25 | By default, these build steps will build the `oadr` and `oadrsd` libraries, and the 26 | `samplevenmanager` executable. To build the unit test program `testoadr`, change the cmake 27 | command to the following: 28 | ``` 29 | cmake -DTEST=1 ../../ 30 | ``` 31 | 32 | Running `testoadr` will execute the unit tests. 33 | 34 | # Sample VEN Manager 35 | The `samplevenmanager` directory demonstrates how to use the library. The basic 36 | steps are: 37 | 1. Create a class which implements the folloiwng interfaces: IEventService, 38 | IReportService, IOadrMessage, and IOADRExceptionService. In the sample, the 39 | class `VENImpl` implements these interfaces. The OpenADR library will call 40 | these functions at the appropriate time. 41 | 42 | 1. Create a `VENManagerConfig` object and populate the interfaces pointers and 43 | timeouts. The interface pointers should point to your object (or objects) 44 | created in the previous step. 45 | 46 | 1. Create a `VENManager` object by calling `VENManager::init()`, passing in the 47 | VENManagerConfig object created in the previous step. 48 | 49 | 1. Call the run() function on the object created in the previous step to start 50 | the VEN. This function call will block. Start the VEN manager in its own 51 | thread if you don't want to block on the run function. 52 | -------------------------------------------------------------------------------- /README.valgrind: -------------------------------------------------------------------------------- 1 | valgrind --track-fds=yes --log-file=valgrind.log --leak-check=full --show-reachable=yes ./oadrtest.out 2 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | v0.7.0 2 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Testing Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Ajay Joshi 7 | Balázs Dán 8 | Bharat Mediratta 9 | Chandler Carruth 10 | Chris Prince 11 | Chris Taylor 12 | Dan Egnor 13 | Eric Roman 14 | Hady Zalek 15 | Jeffrey Yasskin 16 | Jói Sigurðsson 17 | Keir Mierle 18 | Keith Ray 19 | Kenton Varda 20 | Manuel Klimek 21 | Markus Heule 22 | Mika Raento 23 | Miklós Fazekas 24 | Pasi Valminen 25 | Patrick Hanna 26 | Patrick Riley 27 | Peter Kaminski 28 | Preston Jackson 29 | Rainer Klaffenboeck 30 | Russ Cox 31 | Russ Rufer 32 | Sean Mcafee 33 | Sigurður Ásgeirsson 34 | Tracy Bialik 35 | Vadim Berman 36 | Vlad Losev 37 | Zhanyong Wan 38 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/build-aux/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epri-dev/OpenADR-VEN-Library/16546464fe1dc714a126474aaadf75483ec9cbc6/googletest-release-1.7.0/build-aux/.keep -------------------------------------------------------------------------------- /googletest-release-1.7.0/codegear/gtest_all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: Josh Kelley (joshkel@gmail.com) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // C++Builder's IDE cannot build a static library from files with hyphens 35 | // in their name. See http://qc.codegear.com/wc/qcmain.aspx?d=70977 . 36 | // This file serves as a workaround. 37 | 38 | #include "src/gtest-all.cc" 39 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/codegear/gtest_link.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: Josh Kelley (joshkel@gmail.com) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // Links gtest.lib and gtest_main.lib into the current project in C++Builder. 35 | // This means that these libraries can't be renamed, but it's the only way to 36 | // ensure that Debug versus Release test builds are linked against the 37 | // appropriate Debug or Release build of the libraries. 38 | 39 | #pragma link "gtest.lib" 40 | #pragma link "gtest_main.lib" 41 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/samples/sample1.h: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #ifndef GTEST_SAMPLES_SAMPLE1_H_ 35 | #define GTEST_SAMPLES_SAMPLE1_H_ 36 | 37 | // Returns n! (the factorial of n). For negative n, n! is defined to be 1. 38 | int Factorial(int n); 39 | 40 | // Returns true iff n is a prime number. 41 | bool IsPrime(int n); 42 | 43 | #endif // GTEST_SAMPLES_SAMPLE1_H_ 44 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/samples/sample4.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #include 35 | 36 | #include "sample4.h" 37 | 38 | // Returns the current counter value, and increments it. 39 | int Counter::Increment() { 40 | return counter_++; 41 | } 42 | 43 | // Prints the current counter value to STDOUT. 44 | void Counter::Print() const { 45 | printf("%d", counter_); 46 | } 47 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/samples/sample4_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include "gtest/gtest.h" 33 | #include "sample4.h" 34 | 35 | // Tests the Increment() method. 36 | TEST(Counter, Increment) { 37 | Counter c; 38 | 39 | // EXPECT_EQ() evaluates its arguments exactly once, so they 40 | // can have side effects. 41 | 42 | EXPECT_EQ(0, c.Increment()); 43 | EXPECT_EQ(1, c.Increment()); 44 | EXPECT_EQ(2, c.Increment()); 45 | } 46 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/scripts/test/Makefile: -------------------------------------------------------------------------------- 1 | # A Makefile for fusing Google Test and building a sample test against it. 2 | # 3 | # SYNOPSIS: 4 | # 5 | # make [all] - makes everything. 6 | # make TARGET - makes the given target. 7 | # make check - makes everything and runs the built sample test. 8 | # make clean - removes all files generated by make. 9 | 10 | # Points to the root of fused Google Test, relative to where this file is. 11 | FUSED_GTEST_DIR = output 12 | 13 | # Paths to the fused gtest files. 14 | FUSED_GTEST_H = $(FUSED_GTEST_DIR)/gtest/gtest.h 15 | FUSED_GTEST_ALL_CC = $(FUSED_GTEST_DIR)/gtest/gtest-all.cc 16 | 17 | # Where to find the sample test. 18 | SAMPLE_DIR = ../../samples 19 | 20 | # Where to find gtest_main.cc. 21 | GTEST_MAIN_CC = ../../src/gtest_main.cc 22 | 23 | # Flags passed to the preprocessor. 24 | # We have no idea here whether pthreads is available in the system, so 25 | # disable its use. 26 | CPPFLAGS += -I$(FUSED_GTEST_DIR) -DGTEST_HAS_PTHREAD=0 27 | 28 | # Flags passed to the C++ compiler. 29 | CXXFLAGS += -g 30 | 31 | all : sample1_unittest 32 | 33 | check : all 34 | ./sample1_unittest 35 | 36 | clean : 37 | rm -rf $(FUSED_GTEST_DIR) sample1_unittest *.o 38 | 39 | $(FUSED_GTEST_H) : 40 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) 41 | 42 | $(FUSED_GTEST_ALL_CC) : 43 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) 44 | 45 | gtest-all.o : $(FUSED_GTEST_H) $(FUSED_GTEST_ALL_CC) 46 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(FUSED_GTEST_DIR)/gtest/gtest-all.cc 47 | 48 | gtest_main.o : $(FUSED_GTEST_H) $(GTEST_MAIN_CC) 49 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_MAIN_CC) 50 | 51 | sample1.o : $(SAMPLE_DIR)/sample1.cc $(SAMPLE_DIR)/sample1.h 52 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1.cc 53 | 54 | sample1_unittest.o : $(SAMPLE_DIR)/sample1_unittest.cc \ 55 | $(SAMPLE_DIR)/sample1.h $(FUSED_GTEST_H) 56 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1_unittest.cc 57 | 58 | sample1_unittest : sample1.o sample1_unittest.o gtest-all.o gtest_main.o 59 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@ 60 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/src/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | 32 | #include "gtest/gtest.h" 33 | 34 | GTEST_API_ int main(int argc, char **argv) { 35 | printf("Running main() from gtest_main.cc\n"); 36 | testing::InitGoogleTest(&argc, argv); 37 | return RUN_ALL_TESTS(); 38 | } 39 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/test/gtest_main_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include "gtest/gtest.h" 33 | 34 | // Tests that we don't have to define main() when we link to 35 | // gtest_main instead of gtest. 36 | 37 | namespace { 38 | 39 | TEST(GTestMainTest, ShouldSucceed) { 40 | } 41 | 42 | } // namespace 43 | 44 | // We are using the main() function defined in src/gtest_main.cc, so 45 | // we don't define it here. 46 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/test/gtest_uninitialized_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include "gtest/gtest.h" 33 | 34 | TEST(DummyTest, Dummy) { 35 | // This test doesn't verify anything. We just need it to create a 36 | // realistic stage for testing the behavior of Google Test when 37 | // RUN_ALL_TESTS() is called without testing::InitGoogleTest() being 38 | // called first. 39 | } 40 | 41 | int main() { 42 | return RUN_ALL_TESTS(); 43 | } 44 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/test/production.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // This is part of the unit test for include/gtest/gtest_prod.h. 33 | 34 | #include "production.h" 35 | 36 | PrivateCode::PrivateCode() : x_(0) {} 37 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/xcode/Config/DebugProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // DebugProject.xcconfig 3 | // 4 | // These are Debug Configuration project settings for the gtest framework and 5 | // examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // No optimization 14 | GCC_OPTIMIZATION_LEVEL = 0 15 | 16 | // Deployment postprocessing is what triggers Xcode to strip, turn it off 17 | DEPLOYMENT_POSTPROCESSING = NO 18 | 19 | // Dead code stripping off 20 | DEAD_CODE_STRIPPING = NO 21 | 22 | // Debug symbols should be on obviously 23 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES 24 | 25 | // Define the DEBUG macro in all debug builds 26 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DDEBUG=1 27 | 28 | // These are turned off to avoid STL incompatibilities with client code 29 | // // Turns on special C++ STL checks to "encourage" good STL use 30 | // GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _GLIBCXX_DEBUG_PEDANTIC _GLIBCXX_DEBUG _GLIBCPP_CONCEPT_CHECKS 31 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/xcode/Config/FrameworkTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // FrameworkTarget.xcconfig 3 | // 4 | // These are Framework target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Dynamic libs need to be position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Dynamic libs should not have their external symbols stripped. 14 | STRIP_STYLE = non-global 15 | 16 | // Let the user install by specifying the $DSTROOT with xcodebuild 17 | SKIP_INSTALL = NO 18 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/xcode/Config/General.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // General.xcconfig 3 | // 4 | // These are General configuration settings for the gtest framework and 5 | // examples. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Build for PPC and Intel, 32- and 64-bit 11 | ARCHS = i386 x86_64 ppc ppc64 12 | 13 | // Zerolink prevents link warnings so turn it off 14 | ZERO_LINK = NO 15 | 16 | // Prebinding considered unhelpful in 10.3 and later 17 | PREBINDING = NO 18 | 19 | // Strictest warning policy 20 | WARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow 21 | 22 | // Work around Xcode bugs by using external strip. See: 23 | // http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html 24 | SEPARATE_STRIP = YES 25 | 26 | // Force C99 dialect 27 | GCC_C_LANGUAGE_STANDARD = c99 28 | 29 | // not sure why apple defaults this on, but it's pretty risky 30 | ALWAYS_SEARCH_USER_PATHS = NO 31 | 32 | // Turn on position dependent code for most cases (overridden where appropriate) 33 | GCC_DYNAMIC_NO_PIC = YES 34 | 35 | // Default SDK and minimum OS version is 10.4 36 | SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk 37 | MACOSX_DEPLOYMENT_TARGET = 10.4 38 | GCC_VERSION = 4.0 39 | 40 | // VERSIONING BUILD SETTINGS (used in Info.plist) 41 | GTEST_VERSIONINFO_ABOUT = © 2008 Google Inc. 42 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/xcode/Config/ReleaseProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ReleaseProject.xcconfig 3 | // 4 | // These are Release Configuration project settings for the gtest framework 5 | // and examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // subconfig/Release.xcconfig 14 | 15 | // Optimize for space and size (Apple recommendation) 16 | GCC_OPTIMIZATION_LEVEL = s 17 | 18 | // Deploment postprocessing is what triggers Xcode to strip 19 | DEPLOYMENT_POSTPROCESSING = YES 20 | 21 | // No symbols 22 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO 23 | 24 | // Dead code strip does not affect ObjC code but can help for C 25 | DEAD_CODE_STRIPPING = YES 26 | 27 | // NDEBUG is used by things like assert.h, so define it for general compat. 28 | // ASSERT going away in release tends to create unused vars. 29 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DNDEBUG=1 -Wno-unused-variable 30 | 31 | // When we strip we want to strip all symbols in release, but save externals. 32 | STRIP_STYLE = all 33 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/xcode/Config/StaticLibraryTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // StaticLibraryTarget.xcconfig 3 | // 4 | // These are static library target settings for libgtest.a. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Static libs can be included in bundles so make them position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Static libs should not have their internal globals or external symbols 14 | // stripped. 15 | STRIP_STYLE = debugging 16 | 17 | // Let the user install by specifying the $DSTROOT with xcodebuild 18 | SKIP_INSTALL = NO 19 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/xcode/Config/TestTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // TestTarget.xcconfig 3 | // 4 | // These are Test target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | 7 | PRODUCT_NAME = $(TARGET_NAME) 8 | HEADER_SEARCH_PATHS = ../include 9 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/xcode/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.${PRODUCT_NAME} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | GTEST_VERSIONINFO_LONG 21 | CFBundleShortVersionString 22 | GTEST_VERSIONINFO_SHORT 23 | CFBundleGetInfoString 24 | ${PRODUCT_NAME} GTEST_VERSIONINFO_LONG, ${GTEST_VERSIONINFO_ABOUT} 25 | NSHumanReadableCopyright 26 | ${GTEST_VERSIONINFO_ABOUT} 27 | CSResourcesFileMapped 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /googletest-release-1.7.0/xcode/Samples/FrameworkSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.gtest.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | CSResourcesFileMapped 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /oadr/.gitignore: -------------------------------------------------------------------------------- 1 | /Debug 2 | /Release 3 | /mac-Debug 4 | -------------------------------------------------------------------------------- /oadr/oadr/helper/DateTimeConverter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * DateTimeConverter.cpp 3 | * 4 | * Created on: Jun 22, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "DateTimeConverter.h" 9 | 10 | DateTimeConverter::DateTimeConverter() 11 | { 12 | } 13 | 14 | /********************************************************************************/ 15 | 16 | DateTimeConverter::~DateTimeConverter() 17 | { 18 | } 19 | 20 | /********************************************************************************/ 21 | 22 | time_t DateTimeConverter::DateTimeToTime_t(icalendar_2_0::dtstart::date_time_type dt) 23 | { 24 | struct tm tm_utc; 25 | 26 | memset(&tm_utc , 0, sizeof(tm)); 27 | 28 | tm_utc.tm_year = dt.year() - 1900; 29 | tm_utc.tm_mon = dt.month() - 1; 30 | tm_utc.tm_mday = dt.day(); 31 | tm_utc.tm_hour = dt.hours(); 32 | tm_utc.tm_min = dt.minutes(); 33 | tm_utc.tm_sec = (int)dt.seconds(); 34 | tm_utc.tm_isdst = -1; 35 | 36 | // 37 | // The function timegm(...) is non-standard :(. The man pages suggest 38 | // setting the TZ variable (implemented below) 39 | // return timegm(&tm_utc); 40 | 41 | // 42 | // Before we can call mktime(&tm_utc), we have to set the timezone 43 | // to utc 44 | 45 | Timezone tz; 46 | 47 | tz.StoreEnvTZ(); 48 | 49 | tz.SetTimezone(""); 50 | 51 | time_t ret = mktime(&tm_utc); 52 | 53 | tz.RestoreEnvTZ(); 54 | 55 | return ret; 56 | } 57 | 58 | /********************************************************************************/ 59 | 60 | icalendar_2_0::dtstart::date_time_type DateTimeConverter::Time_tToDateTime(time_t t) 61 | { 62 | struct tm parts; 63 | 64 | memset(&parts , 0, sizeof(tm)); 65 | 66 | gmtime_r(&t, &parts); 67 | 68 | icalendar_2_0::dtstart::date_time_type dt(::xml_schema::date_time(parts.tm_year + 1900, parts.tm_mon + 1, parts.tm_mday, parts.tm_hour, 69 | parts.tm_min, parts.tm_sec, 0, 0)); 70 | 71 | return dt; 72 | } 73 | -------------------------------------------------------------------------------- /oadr/oadr/helper/DateTimeConverter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DateTimeConverter.h 3 | * 4 | * Created on: Jun 22, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_HELPER_DATETIMECONVERTER_H_ 9 | #define OADR_OADR_HELPER_DATETIMECONVERTER_H_ 10 | 11 | #include "Timezone.h" 12 | 13 | #include 14 | #include 15 | 16 | class DateTimeConverter 17 | { 18 | private: 19 | DateTimeConverter(); 20 | 21 | public: 22 | virtual ~DateTimeConverter(); 23 | 24 | static time_t DateTimeToTime_t(icalendar_2_0::dtstart::date_time_type dt); 25 | 26 | static icalendar_2_0::dtstart::date_time_type Time_tToDateTime(time_t t); 27 | }; 28 | 29 | #endif /* OADR_OADR_HELPER_DATETIMECONVERTER_H_ */ 30 | -------------------------------------------------------------------------------- /oadr/oadr/helper/Timezone.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeZone.cpp 3 | * 4 | * Created on: Jun 29, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "Timezone.h" 9 | 10 | #include 11 | #include 12 | 13 | Timezone::Timezone() : 14 | m_envTZ(NULL), 15 | m_envIsStored(false) 16 | { 17 | } 18 | 19 | /********************************************************************************/ 20 | 21 | Timezone::~Timezone() 22 | { 23 | RestoreEnvTZ(); 24 | } 25 | 26 | /********************************************************************************/ 27 | 28 | void Timezone::SetTimezone(std::string timeZone) 29 | { 30 | setenv("TZ", timeZone.c_str(), 1); 31 | 32 | tzset(); 33 | } 34 | 35 | /********************************************************************************/ 36 | 37 | void Timezone::StoreEnvTZ() 38 | { 39 | m_envIsStored = true; 40 | 41 | char *tz = getenv("TZ"); 42 | 43 | if (tz) 44 | m_envTZ = strdup(tz); 45 | } 46 | 47 | /********************************************************************************/ 48 | 49 | void Timezone::RestoreEnvTZ() 50 | { 51 | // StoreEnvTZ was never called so there's nothing to restore 52 | if (!m_envIsStored) 53 | return; 54 | 55 | // m_envTZ != NULL indicates the TZ environment variable 56 | // was set and needs to be restored 57 | if (m_envTZ) 58 | { 59 | setenv("TZ", m_envTZ, 1); 60 | free(m_envTZ); 61 | m_envTZ = NULL; 62 | } 63 | else 64 | { 65 | // The TZ environment variable was not set and need to be removed 66 | unsetenv("TZ"); 67 | } 68 | 69 | tzset(); 70 | 71 | m_envIsStored = false; 72 | } 73 | -------------------------------------------------------------------------------- /oadr/oadr/helper/Timezone.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeZone.h 3 | * 4 | * Created on: Jun 29, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADRTEST_OADRTEST_HELPER_TIMEZONE_H_ 9 | #define OADRTEST_OADRTEST_HELPER_TIMEZONE_H_ 10 | 11 | #include 12 | 13 | #include 14 | 15 | class Timezone 16 | { 17 | private: 18 | char *m_envTZ; 19 | 20 | bool m_envIsStored; 21 | 22 | public: 23 | Timezone(); 24 | virtual ~Timezone(); 25 | 26 | /** 27 | * Set the timezone (US/Central, US/Eastern, etc,) 28 | * Use an empty string to set UTC/GMT 29 | * On Linux, timezone files can be found in /usr/share/zoneinfo 30 | * The timezone parameter points to a file under the zoneinfo directory 31 | */ 32 | void SetTimezone(std::string timeZone); 33 | 34 | /** 35 | * Stores the existing TZ environment variable 36 | */ 37 | void StoreEnvTZ(); 38 | 39 | /** 40 | * Restore the TZ environment variable (StoreEnvTZ must be called first) 41 | */ 42 | void RestoreEnvTZ(); 43 | }; 44 | 45 | #endif /* OADRTEST_OADRTEST_HELPER_TIMEZONE_H_ */ 46 | -------------------------------------------------------------------------------- /oadr/oadr/helper/conditionalsleep/ConditionalSleep.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SleepTimer.cpp 3 | * 4 | * Created on: Jun 25, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "ConditionalSleep.h" 9 | 10 | ConditionalSleep::ConditionalSleep() 11 | { 12 | } 13 | 14 | /********************************************************************************/ 15 | 16 | ConditionalSleep::~ConditionalSleep() 17 | { 18 | } 19 | 20 | /********************************************************************************/ 21 | 22 | bool ConditionalSleep::waitUntil(std::unique_lock &lock, time_t t) 23 | { 24 | if (m_condition.wait_until(lock, chrono::system_clock::from_time_t(t)) == std::cv_status::timeout) 25 | return true; 26 | 27 | return false; 28 | } 29 | 30 | /********************************************************************************/ 31 | 32 | bool ConditionalSleep::waitFor(std::unique_lock &lock, std::chrono::seconds s) 33 | { 34 | if (m_condition.wait_for(lock, s) == std::cv_status::timeout) 35 | return true; 36 | 37 | return false; 38 | } 39 | 40 | /********************************************************************************/ 41 | 42 | void ConditionalSleep::notifyOne() 43 | { 44 | m_condition.notify_one(); 45 | } 46 | 47 | /********************************************************************************/ 48 | 49 | void ConditionalSleep::notifyAll() 50 | { 51 | m_condition.notify_all(); 52 | } 53 | -------------------------------------------------------------------------------- /oadr/oadr/helper/conditionalsleep/ConditionalSleep.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SleepTimer.h 3 | * 4 | * Created on: Jun 25, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_HELPER_CONDITIONALSLEEP_CONDITIONALSLEEP_H_ 9 | #define OADR_OADR_HELPER_CONDITIONALSLEEP_CONDITIONALSLEEP_H_ 10 | 11 | #include 12 | #include 13 | 14 | #include "IConditionalSleep.h" 15 | 16 | using namespace std; 17 | using namespace std::chrono; 18 | 19 | class ConditionalSleep : public IConditionalSleep 20 | { 21 | private: 22 | std::condition_variable m_condition; 23 | 24 | public: 25 | ConditionalSleep(); 26 | virtual ~ConditionalSleep(); 27 | 28 | virtual bool waitUntil(std::unique_lock &lock, time_t t); 29 | virtual bool waitFor(std::unique_lock &lock, std::chrono::seconds s); 30 | virtual void notifyOne(); 31 | virtual void notifyAll(); 32 | }; 33 | 34 | #endif /* OADR_OADR_HELPER_CONDITIONALSLEEP_CONDITIONALSLEEP_H_ */ 35 | -------------------------------------------------------------------------------- /oadr/oadr/helper/conditionalsleep/IConditionalSleep.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ISleepTimer.cpp 3 | * 4 | * Created on: Jun 25, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "IConditionalSleep.h" 9 | 10 | IConditionalSleep::IConditionalSleep() 11 | { 12 | 13 | } 14 | 15 | /********************************************************************************/ 16 | 17 | IConditionalSleep::~IConditionalSleep() 18 | { 19 | } 20 | 21 | -------------------------------------------------------------------------------- /oadr/oadr/helper/conditionalsleep/IConditionalSleep.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ISleepTimer.h 3 | * 4 | * Created on: Jun 25, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_HELPER_CONDITIONALSLEEP_ICONDITIONALSLEEP_H_ 9 | #define OADR_OADR_HELPER_CONDITIONALSLEEP_ICONDITIONALSLEEP_H_ 10 | 11 | #include 12 | 13 | using namespace std; 14 | 15 | class IConditionalSleep 16 | { 17 | public: 18 | IConditionalSleep(); 19 | virtual ~IConditionalSleep(); 20 | 21 | virtual bool waitUntil(std::unique_lock &lock, time_t t) = 0; 22 | 23 | virtual bool waitFor(std::unique_lock &lock, std::chrono::seconds s) = 0; 24 | 25 | virtual void notifyOne() = 0; 26 | virtual void notifyAll() = 0; 27 | }; 28 | 29 | #endif /* OADR_OADR_HELPER_CONDITIONALSLEEP_ICONDITIONALSLEEP_H_ */ 30 | -------------------------------------------------------------------------------- /oadr/oadr/helper/globaltime/GlobalTime.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * GlobalTime.cpp 3 | * 4 | * Created on: Jun 25, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "GlobalTime.h" 9 | 10 | /********************************************************************************/ 11 | 12 | IGlobalTime *GlobalTime::m_instance = nullptr; 13 | 14 | GlobalTimeStandard GlobalTime::m_defaultGlobalTime; 15 | 16 | /********************************************************************************/ 17 | 18 | GlobalTime::GlobalTime() 19 | { 20 | } 21 | 22 | /********************************************************************************/ 23 | 24 | GlobalTime::~GlobalTime() 25 | { 26 | } 27 | 28 | /********************************************************************************/ 29 | 30 | void GlobalTime::SetDefaultGlobalTime() 31 | { 32 | m_instance = &m_defaultGlobalTime; 33 | } 34 | 35 | /********************************************************************************/ 36 | 37 | void GlobalTime::SetGlobalTime(IGlobalTime *globalTime) 38 | { 39 | m_instance = globalTime; 40 | } 41 | 42 | /********************************************************************************/ 43 | 44 | IGlobalTime *GlobalTime::Instance() 45 | { 46 | if (m_instance == nullptr) 47 | m_instance = &m_defaultGlobalTime; 48 | 49 | return m_instance; 50 | } 51 | -------------------------------------------------------------------------------- /oadr/oadr/helper/globaltime/GlobalTime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GlobalTime.h 3 | * 4 | * Created on: Jun 25, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_HELPER_GLOBALTIME_GLOBALTIME_H_ 9 | #define OADR_OADR_HELPER_GLOBALTIME_GLOBALTIME_H_ 10 | 11 | #include "IGlobalTime.h" 12 | 13 | #include "GlobalTimeStandard.h" 14 | 15 | class GlobalTime : public IGlobalTime 16 | { 17 | private: 18 | static IGlobalTime *m_instance; 19 | 20 | static GlobalTimeStandard m_defaultGlobalTime; 21 | 22 | public: 23 | GlobalTime(); 24 | virtual ~GlobalTime(); 25 | 26 | static void SetDefaultGlobalTime(); 27 | static void SetGlobalTime(IGlobalTime *globalTime); 28 | 29 | static IGlobalTime *Instance(); 30 | }; 31 | 32 | #endif /* OADR_OADR_HELPER_GLOBALTIME_GLOBALTIME_H_ */ 33 | -------------------------------------------------------------------------------- /oadr/oadr/helper/globaltime/GlobalTimeStandard.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * GlobalTimeStandard.cpp 3 | * 4 | * Created on: Dec 14, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "GlobalTimeStandard.h" 9 | 10 | GlobalTimeStandard::GlobalTimeStandard() 11 | { 12 | // TODO Auto-generated constructor stub 13 | 14 | } 15 | 16 | /********************************************************************************/ 17 | 18 | GlobalTimeStandard::~GlobalTimeStandard() 19 | { 20 | // TODO Auto-generated destructor stub 21 | } 22 | 23 | /********************************************************************************/ 24 | 25 | time_t GlobalTimeStandard::now() 26 | { 27 | return time(NULL); 28 | } 29 | -------------------------------------------------------------------------------- /oadr/oadr/helper/globaltime/GlobalTimeStandard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GlobalTimeStandard.h 3 | * 4 | * Created on: Dec 14, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_HELPER_GLOBALTIME_GLOBALTIMESTANDARD_H_ 9 | #define OADR_OADR_HELPER_GLOBALTIME_GLOBALTIMESTANDARD_H_ 10 | 11 | #include "IGlobalTime.h" 12 | 13 | class GlobalTimeStandard: public IGlobalTime 14 | { 15 | public: 16 | GlobalTimeStandard(); 17 | virtual ~GlobalTimeStandard(); 18 | 19 | virtual time_t now(); 20 | }; 21 | 22 | #endif /* OADR_OADR_HELPER_GLOBALTIME_GLOBALTIMESTANDARD_H_ */ 23 | -------------------------------------------------------------------------------- /oadr/oadr/helper/globaltime/IGlobalTime.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * IGlobalTime.cpp 3 | * 4 | * Created on: Jun 25, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "IGlobalTime.h" 9 | 10 | /********************************************************************************/ 11 | 12 | IGlobalTime::IGlobalTime() 13 | { 14 | } 15 | 16 | /********************************************************************************/ 17 | 18 | IGlobalTime::~IGlobalTime() 19 | { 20 | } 21 | 22 | -------------------------------------------------------------------------------- /oadr/oadr/helper/globaltime/IGlobalTime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IGlobalTime.h 3 | * 4 | * Created on: Jun 25, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_HELPER_GLOBALTIME_IGLOBALTIME_H_ 9 | #define OADR_OADR_HELPER_GLOBALTIME_IGLOBALTIME_H_ 10 | 11 | #include 12 | 13 | class IGlobalTime 14 | { 15 | public: 16 | IGlobalTime(); 17 | virtual ~IGlobalTime(); 18 | 19 | virtual time_t now() = 0; 20 | }; 21 | 22 | #endif /* OADR_OADR_HELPER_GLOBALTIME_IGLOBALTIME_H_ */ 23 | -------------------------------------------------------------------------------- /oadr/oadr/helper/thread/IRun.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * IRun.cpp 3 | * 4 | * Created on: May 15, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "IRun.h" 9 | 10 | IRun::IRun() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | IRun::~IRun() { 16 | // TODO Auto-generated destructor stub 17 | } 18 | 19 | -------------------------------------------------------------------------------- /oadr/oadr/helper/thread/IRun.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IRun.h 3 | * 4 | * Created on: May 15, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef IRUN_H_ 9 | #define IRUN_H_ 10 | 11 | class IRun 12 | { 13 | public: 14 | IRun(); 15 | virtual ~IRun(); 16 | 17 | virtual void run() = 0; 18 | virtual void stop() = 0; 19 | }; 20 | 21 | #endif /* IRUN_H_ */ 22 | -------------------------------------------------------------------------------- /oadr/oadr/helper/thread/ThreadRunner.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ThreadRunner.cpp 3 | * 4 | * Created on: May 15, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "ThreadRunner.h" 9 | 10 | ThreadRunner::ThreadRunner(IRun *run, string name) : 11 | m_run(run), 12 | m_name(name) 13 | { 14 | m_thread = NULL; 15 | } 16 | 17 | //=============================================================================================== 18 | 19 | ThreadRunner::~ThreadRunner() 20 | { 21 | if (m_thread != NULL) 22 | { 23 | stop(); 24 | join(); 25 | } 26 | } 27 | 28 | //=============================================================================================== 29 | 30 | void ThreadRunner::start() 31 | { 32 | m_thread = new thread(&IRun::run, m_run); 33 | } 34 | 35 | //=============================================================================================== 36 | 37 | void ThreadRunner::stop() 38 | { 39 | m_run->stop(); 40 | } 41 | 42 | //=============================================================================================== 43 | 44 | void ThreadRunner::join() 45 | { 46 | if (m_thread == NULL) 47 | { 48 | return; 49 | } 50 | 51 | m_thread->join(); 52 | 53 | delete (m_thread); 54 | m_thread = NULL; 55 | } 56 | -------------------------------------------------------------------------------- /oadr/oadr/helper/thread/ThreadRunner.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ThreadRunner.h 3 | * 4 | * Created on: May 15, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef THREADRUNNER_H_ 9 | #define THREADRUNNER_H_ 10 | 11 | #include 12 | #include 13 | 14 | #include "IRun.h" 15 | 16 | using namespace std; 17 | 18 | class ThreadRunner 19 | { 20 | private: 21 | IRun *m_run; 22 | 23 | thread *m_thread; 24 | 25 | string m_name; 26 | 27 | public: 28 | ThreadRunner(IRun *run, string name = ""); 29 | 30 | virtual ~ThreadRunner(); 31 | 32 | void start(); 33 | void stop(); 34 | 35 | void join(); 36 | }; 37 | 38 | #endif /* THREADRUNNER_H_ */ 39 | -------------------------------------------------------------------------------- /oadr/oadr/manager/IOADRExceptionService.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * IOADRExceptionService.cpp 3 | * 4 | * Created on: May 27, 2016 5 | * Author: dupes 6 | */ 7 | 8 | #include "IOADRExceptionService.h" 9 | 10 | IOADRExceptionService::IOADRExceptionService() 11 | { 12 | } 13 | 14 | IOADRExceptionService::~IOADRExceptionService() 15 | { 16 | } 17 | 18 | -------------------------------------------------------------------------------- /oadr/oadr/manager/IOADRExceptionService.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IOADRExceptionService.h 3 | * 4 | * Created on: May 27, 2016 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_MANAGER_IOADREXCEPTIONSERVICE_H_ 9 | #define OADR_OADR_MANAGER_IOADREXCEPTIONSERVICE_H_ 10 | 11 | #include 12 | 13 | #include "../ven/http/CurlException.h" 14 | 15 | class IOADRExceptionService 16 | { 17 | public: 18 | IOADRExceptionService(); 19 | virtual ~IOADRExceptionService(); 20 | 21 | virtual void OnCurlException(CurlException &ex) = 0; 22 | 23 | virtual void OnException(std::exception &ex) = 0; 24 | }; 25 | 26 | #endif /* OADR_OADR_MANAGER_IOADREXCEPTIONSERVICE_H_ */ 27 | -------------------------------------------------------------------------------- /oadr/oadr/manager/IVENManager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * IVENManager.cpp 3 | * 4 | * Created on: Jul 9, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "IVENManager.h" 9 | 10 | IVENManager::IVENManager() 11 | { 12 | } 13 | 14 | IVENManager::~IVENManager() 15 | { 16 | } 17 | 18 | -------------------------------------------------------------------------------- /oadr/oadr/manager/IVENManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IVENManager.h 3 | * 4 | * Created on: Jul 9, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_MANAGER_IVENMANAGER_H_ 9 | #define OADR_OADR_MANAGER_IVENMANAGER_H_ 10 | 11 | #include 12 | 13 | #include "../helper/thread/IRun.h" 14 | #include "../scheduler/Scheduler.h" 15 | 16 | class IVENManager : public IRun 17 | { 18 | public: 19 | IVENManager(); 20 | virtual ~IVENManager(); 21 | 22 | virtual Scheduler *getScheduler() = 0; 23 | }; 24 | 25 | #endif /* OADR_OADR_MANAGER_IVENMANAGER_H_ */ 26 | -------------------------------------------------------------------------------- /oadr/oadr/manager/VENManagerConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * VENManagerConfig.h 3 | * 4 | * Created on: May 17, 2016 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_MANAGER_VENMANAGERCONFIG_H_ 9 | #define OADR_OADR_MANAGER_VENMANAGERCONFIG_H_ 10 | 11 | #include 12 | 13 | // TODO: needed for TLS default version 14 | // remove reliance on curl 15 | #include 16 | 17 | #include "eventmanager/IEventService.h" 18 | #include "reportmanager/IReportService.h" 19 | #include "IOADRExceptionService.h" 20 | #include "../ven/IOadrMessage.h" 21 | 22 | struct ttls 23 | { 24 | bool useTls; 25 | 26 | std::string certPath; 27 | std::string privateKeyPath; 28 | std::string caBundlePath; 29 | bool verifyHostname; 30 | std::string cipherList; 31 | long sslVersion; 32 | }; 33 | 34 | struct tservices 35 | { 36 | IEventService *eventService; 37 | IReportService *reportService; 38 | IOADRExceptionService *exceptionService; 39 | IOadrMessage *oadrMessage; 40 | }; 41 | 42 | struct ttimeouts 43 | { 44 | unsigned int connectTimeout; 45 | unsigned int requestTimeout; 46 | }; 47 | 48 | struct VENManagerConfig 49 | { 50 | std::string vtnURL; 51 | std::string venName; 52 | std::string venID; 53 | std::string registrationID; 54 | 55 | ttls tls; 56 | 57 | tservices services; 58 | 59 | ttimeouts timeouts; 60 | 61 | VENManagerConfig() 62 | { 63 | tls.useTls = false; 64 | tls.verifyHostname = true; 65 | tls.cipherList = "AES128-SHA256:ECDHE-ECDSA-AES128-SHA256"; 66 | tls.sslVersion = CURL_SSLVERSION_TLSv1_2; 67 | 68 | services.eventService = NULL; 69 | services.reportService = NULL; 70 | services.exceptionService = NULL; 71 | services.oadrMessage = &OadrMessageBlank::oadrMessageBlank; 72 | 73 | timeouts.connectTimeout = 120; 74 | timeouts.requestTimeout = 30; 75 | }; 76 | }; 77 | 78 | #endif /* OADR_OADR_MANAGER_VENMANAGERCONFIG_H_ */ 79 | -------------------------------------------------------------------------------- /oadr/oadr/manager/eventmanager/IEventService.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * IEventService.cpp 3 | * 4 | * Created on: Jun 22, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "IEventService.h" 9 | 10 | IEventService::IEventService() 11 | { 12 | } 13 | 14 | IEventService::~IEventService() 15 | { 16 | } 17 | 18 | -------------------------------------------------------------------------------- /oadr/oadr/manager/eventmanager/IEventService.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IEventService.h 3 | * 4 | * Created on: Jun 22, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_VEN_VENMANAGER_IEVENTSERVICE_H_ 9 | #define OADR_OADR_VEN_VENMANAGER_IEVENTSERVICE_H_ 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | class IEventService 17 | { 18 | public: 19 | IEventService(); 20 | virtual ~IEventService(); 21 | 22 | virtual void OnEventStart(const std::string &eventID, const oadr2b::oadr::oadrEvent *event, unsigned int remainingDurationInSeconds) = 0; 23 | virtual void OnEventComplete(const std::string &eventID, const oadr2b::oadr::oadrEvent *event) = 0; 24 | virtual void OnEventIntervalStart(const std::string &eventID, const oadr2b::oadr::oadrEvent *event, const oadr2b::ei::eiEventSignalType *eventSignal, std::string uid, float payload, time_t dtstart, unsigned int remainingDurationInSeconds) = 0; 25 | 26 | virtual void OnEventNew(const std::string &eventID, const oadr2b::oadr::oadrEvent *event, oadr2b::ei::OptTypeType::value &optType) = 0; 27 | virtual void OnEventModify(const std::string &eventID, const oadr2b::oadr::oadrEvent *newEvent, const oadr2b::oadr::oadrEvent *oldEvent, oadr2b::ei::OptTypeType::value &optType) = 0; 28 | 29 | virtual void OnEventCancel(const std::string &eventID, const oadr2b::oadr::oadrEvent *event, oadr2b::ei::OptTypeType::value &optType) = 0; 30 | 31 | virtual void OnEventImplicitCancel(const std::string &eventID, const oadr2b::oadr::oadrEvent *event) = 0; 32 | }; 33 | 34 | #endif /* OADR_OADR_VEN_VENMANAGER_IEVENTSERVICE_H_ */ 35 | -------------------------------------------------------------------------------- /oadr/oadr/manager/eventmanager/ISendCreatedEvent.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ISendCreatedEvent.cpp 3 | * 4 | * Created on: Jul 7, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "ISendCreatedEvent.h" 9 | 10 | ISendCreatedEvent::ISendCreatedEvent() 11 | { 12 | } 13 | 14 | ISendCreatedEvent::~ISendCreatedEvent() 15 | { 16 | } 17 | 18 | -------------------------------------------------------------------------------- /oadr/oadr/manager/eventmanager/ISendCreatedEvent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ISendCreatedEvent.h 3 | * 4 | * Created on: Jul 7, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_MANAGER_EVENTMANAGER_ISENDCREATEDEVENT_H_ 9 | #define OADR_OADR_MANAGER_EVENTMANAGER_ISENDCREATEDEVENT_H_ 10 | 11 | #include 12 | 13 | #include 14 | 15 | using namespace std; 16 | 17 | class ISendCreatedEvent 18 | { 19 | public: 20 | ISendCreatedEvent(); 21 | virtual ~ISendCreatedEvent(); 22 | 23 | virtual void sendCreatedEvent(string responseCode, string responseDescription, string requestID, oadr2b::ei::eventResponses::eventResponse_sequence &eventResponses) = 0; 24 | }; 25 | 26 | #endif /* OADR_OADR_MANAGER_EVENTMANAGER_ISENDCREATEDEVENT_H_ */ 27 | -------------------------------------------------------------------------------- /oadr/oadr/manager/eventmanager/job/event/JobEventComplete.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * JobEventComplete.cpp 3 | * 4 | * Created on: Jun 22, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "JobEventComplete.h" 9 | 10 | JobEventComplete::JobEventComplete(IEventService *service, const oadr2b::oadr::oadrEvent *event) : 11 | m_service(service), 12 | m_event(event) 13 | { 14 | } 15 | 16 | /********************************************************************************/ 17 | 18 | JobEventComplete::~JobEventComplete() 19 | { 20 | 21 | } 22 | 23 | /********************************************************************************/ 24 | 25 | void JobEventComplete::execute(time_t now) 26 | { 27 | string eventID = m_event->eiEvent().eventDescriptor().eventID(); 28 | 29 | m_service->OnEventComplete(eventID, m_event); 30 | } 31 | -------------------------------------------------------------------------------- /oadr/oadr/manager/eventmanager/job/event/JobEventComplete.h: -------------------------------------------------------------------------------- 1 | /* 2 | * JobEventComplete.h 3 | * 4 | * Created on: Jun 22, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_VEN_VENMANAGER_JOB_EVENT_JOBEVENTCOMPLETE_H_ 9 | #define OADR_OADR_VEN_VENMANAGER_JOB_EVENT_JOBEVENTCOMPLETE_H_ 10 | 11 | #include "../../../../scheduler/IJob.h" 12 | #include "../../IEventService.h" 13 | 14 | class JobEventComplete : public IJob 15 | { 16 | private: 17 | IEventService *m_service; 18 | const oadr2b::oadr::oadrEvent *m_event; 19 | 20 | public: 21 | JobEventComplete(IEventService *service, const oadr2b::oadr::oadrEvent *event); 22 | virtual ~JobEventComplete(); 23 | 24 | virtual void execute(time_t now); 25 | }; 26 | 27 | #endif /* OADR_OADR_VEN_VENMANAGER_JOB_EVENT_JOBEVENTCOMPLETE_H_ */ 28 | -------------------------------------------------------------------------------- /oadr/oadr/manager/eventmanager/job/event/JobEventIntervalStart.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * JobEventIntervalStart.cpp 3 | * 4 | * Created on: Jun 22, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "JobEventIntervalStart.h" 9 | 10 | JobEventIntervalStart::JobEventIntervalStart(IEventService *service, const oadr2b::oadr::oadrEvent *event, const oadr2b::ei::eiEventSignalType *eventSignal, string uid, float payload, time_t dtstart, int durationInSeconds) : 11 | m_service(service), 12 | m_event(event), 13 | m_eventSignal(eventSignal), 14 | m_uid(uid), 15 | m_payload(payload), 16 | m_dtstart(dtstart), 17 | m_durationInSeconds(durationInSeconds) 18 | { 19 | } 20 | 21 | /********************************************************************************/ 22 | 23 | JobEventIntervalStart::~JobEventIntervalStart() 24 | { 25 | } 26 | 27 | /********************************************************************************/ 28 | 29 | void JobEventIntervalStart::execute(time_t now) 30 | { 31 | string eventID = m_event->eiEvent().eventDescriptor().eventID(); 32 | 33 | m_service->OnEventIntervalStart(eventID, m_event, m_eventSignal, m_uid, m_payload, m_dtstart, m_durationInSeconds); 34 | } 35 | -------------------------------------------------------------------------------- /oadr/oadr/manager/eventmanager/job/event/JobEventIntervalStart.h: -------------------------------------------------------------------------------- 1 | /* 2 | * JobEventIntervalStart.h 3 | * 4 | * Created on: Jun 22, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_VEN_VENMANAGER_JOB_EVENT_JOBEVENTINTERVALSTART_H_ 9 | #define OADR_OADR_VEN_VENMANAGER_JOB_EVENT_JOBEVENTINTERVALSTART_H_ 10 | 11 | #include "../../../../scheduler/IJob.h" 12 | #include "../../IEventService.h" 13 | 14 | class JobEventIntervalStart : public IJob 15 | { 16 | private: 17 | IEventService *m_service; 18 | const oadr2b::oadr::oadrEvent *m_event; 19 | const oadr2b::ei::eiEventSignalType *m_eventSignal; 20 | 21 | string m_uid; 22 | float m_payload; 23 | 24 | time_t m_dtstart; 25 | unsigned int m_durationInSeconds; 26 | 27 | public: 28 | JobEventIntervalStart(IEventService *service, const oadr2b::oadr::oadrEvent *event, const oadr2b::ei::eiEventSignalType *eventSignal, string uid, float payload, time_t dtstart, int durationInSeconds); 29 | virtual ~JobEventIntervalStart(); 30 | 31 | virtual void execute(time_t now); 32 | }; 33 | 34 | #endif /* OADR_OADR_VEN_VENMANAGER_JOB_EVENT_JOBEVENTINTERVALSTART_H_ */ 35 | -------------------------------------------------------------------------------- /oadr/oadr/manager/eventmanager/job/event/JobEventStart.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * JobEventStart.cpp 3 | * 4 | * Created on: Jun 22, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "JobEventStart.h" 9 | #include "../../../../helper/ISO8601Duration.h" 10 | 11 | JobEventStart::JobEventStart(IEventService *service, const oadr2b::oadr::oadrEvent *event) : 12 | m_service(service), 13 | m_event(event) 14 | { 15 | } 16 | 17 | /********************************************************************************/ 18 | 19 | JobEventStart::~JobEventStart() 20 | { 21 | } 22 | 23 | /********************************************************************************/ 24 | 25 | void JobEventStart::execute(time_t now) 26 | { 27 | string eventID = m_event->eiEvent().eventDescriptor().eventID(); 28 | int durationInSeconds = ISO8601Duration::TotalSeconds(m_event->eiEvent().eiActivePeriod().properties().duration().duration()); 29 | 30 | m_service->OnEventStart(eventID, m_event, durationInSeconds); 31 | } 32 | -------------------------------------------------------------------------------- /oadr/oadr/manager/eventmanager/job/event/JobEventStart.h: -------------------------------------------------------------------------------- 1 | /* 2 | * JobEventStart.h 3 | * 4 | * Created on: Jun 22, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_VEN_VENMANAGER_JOB_EVENT_JOBEVENTSTART_H_ 9 | #define OADR_OADR_VEN_VENMANAGER_JOB_EVENT_JOBEVENTSTART_H_ 10 | 11 | #include 12 | 13 | #include "../../../../scheduler/IJob.h" 14 | #include "../../IEventService.h" 15 | 16 | class JobEventStart : public IJob 17 | { 18 | private: 19 | IEventService *m_service; 20 | const oadr2b::oadr::oadrEvent *m_event; 21 | 22 | public: 23 | JobEventStart(IEventService *service, const oadr2b::oadr::oadrEvent *event); 24 | virtual ~JobEventStart(); 25 | 26 | virtual void execute(time_t now); 27 | }; 28 | 29 | #endif /* OADR_OADR_VEN_VENMANAGER_JOB_EVENT_JOBEVENTSTART_H_ */ 30 | -------------------------------------------------------------------------------- /oadr/oadr/manager/reportmanager/IReportService.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * IReportService.cpp 3 | * 4 | * Created on: Sep 10, 2014 5 | * Author: dupes 6 | */ 7 | 8 | #include "../reportmanager/IReportService.h" 9 | 10 | IReportService::IReportService() 11 | { 12 | } 13 | 14 | IReportService::~IReportService() 15 | { 16 | } 17 | 18 | -------------------------------------------------------------------------------- /oadr/oadr/manager/reportmanager/IReportService.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IReportService.h 3 | * 4 | * Created on: Sep 10, 2014 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef IREPORTSERVICE_H_ 9 | #define IREPORTSERVICE_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | using namespace oadr2b::oadr; 18 | using namespace std; 19 | 20 | class IReportService 21 | { 22 | public: 23 | IReportService(); 24 | virtual ~IReportService(); 25 | 26 | virtual void OnPeriodicReportStart(const oadrReportRequestType &reportRequest) = 0; 27 | 28 | virtual void OnPeriodicReportComplete(const oadrReportRequestType &reportRequest) = 0; 29 | 30 | virtual void OnGenerateOneshotReport(const oadrReportRequestType &reportRequest, oadrUpdateReportType::oadrReport_sequence &sequence) = 0; 31 | 32 | virtual void OnGeneratePeriodicReport(const oadrReportRequestType &reportRequest, oadrUpdateReportType::oadrReport_sequence &sequence, time_t dtstart, 33 | unsigned int durationInSeconds) = 0; 34 | 35 | virtual void OnGenerateHistoricalReport(const oadrReportRequestType &reportRequest, oadrUpdateReportType::oadrReport_sequence &sequence, time_t dtstart, 36 | unsigned int durationInSeconds) = 0; 37 | 38 | virtual void OnGenerateRegisterReport(oadrRegisterReportType::oadrReport_sequence &sequence) = 0; 39 | }; 40 | 41 | #endif /* IREPORTSERVICE_H_ */ 42 | -------------------------------------------------------------------------------- /oadr/oadr/manager/reportmanager/ISendReport.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ISendReport.cpp 3 | * 4 | * Created on: Sep 15, 2014 5 | * Author: dupes 6 | */ 7 | 8 | #include "../reportmanager/ISendReport.h" 9 | 10 | ISendReport::ISendReport() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | ISendReport::~ISendReport() { 16 | // TODO Auto-generated destructor stub 17 | } 18 | 19 | -------------------------------------------------------------------------------- /oadr/oadr/manager/reportmanager/ISendReport.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ISendReport.h 3 | * 4 | * Created on: Sep 15, 2014 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef ISENDREPORT_H_ 9 | #define ISENDREPORT_H_ 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | using namespace std; 17 | 18 | using namespace oadr2b::oadr; 19 | 20 | class ISendReport 21 | { 22 | public: 23 | ISendReport(); 24 | virtual ~ISendReport(); 25 | 26 | virtual void sendUpdateReport(oadrUpdateReportType::oadrReport_sequence &sequence, time_t dtstart, string reportRequestID, time_t createdDateTime) = 0; 27 | 28 | virtual void sendCreatedReport(const set &pendingReports, string requestID, string responseCode, string responseDescription) = 0; 29 | 30 | virtual void sendCanceledReport(const set &pendingReports, string requestID, string responseCode, string responseDescription) = 0; 31 | }; 32 | 33 | #endif /* ISENDREPORT_H_ */ 34 | -------------------------------------------------------------------------------- /oadr/oadr/manager/reportmanager/RegisteredReports.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * RegisteredReports.cpp 3 | * 4 | * Created on: Sep 10, 2014 5 | * Author: dupes 6 | */ 7 | 8 | #include "../reportmanager/RegisteredReports.h" 9 | 10 | RegisteredReports::RegisteredReports() 11 | { 12 | } 13 | 14 | /********************************************************************************/ 15 | 16 | RegisteredReports::~RegisteredReports() 17 | { 18 | } 19 | 20 | /********************************************************************************/ 21 | 22 | void RegisteredReports::loadRegisteredReports(oadrRegisterReportType::oadrReport_sequence &sequence) 23 | { 24 | m_reports.clear(); 25 | 26 | for (auto &oadrReport : sequence) 27 | { 28 | string reportSpecifierID = oadrReport.reportSpecifierID(); 29 | 30 | set *reportDescriptions = &m_reports[reportSpecifierID]; 31 | 32 | for (auto &oadrReportDescription : oadrReport.oadrReportDescription()) 33 | { 34 | oadr2b::oadr::oadrReportDescriptionType::rID_type rID = oadrReportDescription.rID(); 35 | 36 | reportDescriptions->insert(rID); 37 | } 38 | } 39 | } 40 | 41 | /********************************************************************************/ 42 | 43 | bool RegisteredReports::reportExists(string reportID) 44 | { 45 | if (m_reports.find(reportID) == m_reports.end()) 46 | return false; 47 | 48 | return true; 49 | } 50 | 51 | /********************************************************************************/ 52 | 53 | bool RegisteredReports::reportDescriptionExists(string reportID, string reportDescriptionID) 54 | { 55 | auto reportItr = m_reports.find(reportID); 56 | 57 | if (reportItr == m_reports.end()) 58 | return false; 59 | 60 | // found the report, let's see if we can find the report description 61 | set *reportDescriptions = &reportItr->second; 62 | 63 | if (reportDescriptions->find(reportDescriptionID) == reportDescriptions->end()) 64 | return false; 65 | 66 | return true; 67 | } 68 | -------------------------------------------------------------------------------- /oadr/oadr/manager/reportmanager/RegisteredReports.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RegisteredReports.h 3 | * 4 | * Created on: Sep 10, 2014 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef REGISTEREDREPORTS_H_ 9 | #define REGISTEREDREPORTS_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | using namespace oadr2b::oadr; 20 | using namespace std; 21 | 22 | class RegisteredReports 23 | { 24 | private: 25 | map> m_reports; 26 | 27 | public: 28 | RegisteredReports(); 29 | virtual ~RegisteredReports(); 30 | 31 | void loadRegisteredReports( 32 | oadrRegisterReportType::oadrReport_sequence &sequence); 33 | 34 | bool reportExists(string reportID); 35 | bool reportDescriptionExists(string reportID, string reportDescriptionID); 36 | }; 37 | 38 | #endif /* REGISTEREDREPORTS_H_ */ 39 | -------------------------------------------------------------------------------- /oadr/oadr/manager/transport/ITransport.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ITransport.cpp 3 | * 4 | * Created on: Jul 8, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "../../manager/transport/ITransport.h" 9 | 10 | ITransport::ITransport() 11 | { 12 | // TODO Auto-generated constructor stub 13 | 14 | } 15 | 16 | ITransport::~ITransport() 17 | { 18 | // TODO Auto-generated destructor stub 19 | } 20 | 21 | -------------------------------------------------------------------------------- /oadr/oadr/manager/transport/ITransport.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ITransport.h 3 | * 4 | * Created on: Jul 8, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_MANAGER_TRANSPORT_ITRANSPORT_H_ 9 | #define OADR_OADR_MANAGER_TRANSPORT_ITRANSPORT_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | enum class OadrEndpoint 17 | { 18 | EiEvent, 19 | EiReport, 20 | EiRegisterParty, 21 | EiOpt, 22 | EiPoll 23 | }; 24 | 25 | class ITransport 26 | { 27 | public: 28 | ITransport(); 29 | virtual ~ITransport(); 30 | 31 | virtual void sendMessage(OadrEndpoint, std::unique_ptr xml) = 0; 32 | 33 | // Two options for getting messages from the transport to VenManager 34 | // option 1: messages are sent to the VenManager as soon as they're received 35 | // option 2: the VenManager polls for messages 36 | // Option 2 gives the VenManager more control and is a more standard approach 37 | // Option 1 push messages to the VenManager as soon as they're received, freeing 38 | // the VenManager from the need to periodically poll for received messages 39 | virtual void setOnMessageCallback(const std::function ()> &function) = 0; 40 | virtual std::unique_ptr getNextMessage(std::chrono::steady_clock::duration d) = 0; 41 | }; 42 | 43 | #endif /* OADR_OADR_MANAGER_TRANSPORT_ITRANSPORT_H_ */ 44 | -------------------------------------------------------------------------------- /oadr/oadr/scheduler/IJob.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ISchedule.cpp 3 | * 4 | * Created on: Oct 5, 2014 5 | * Author: dupes 6 | */ 7 | 8 | #include "IJob.h" 9 | 10 | IJob::IJob() 11 | { 12 | } 13 | 14 | /********************************************************************************/ 15 | 16 | IJob::~IJob() 17 | { 18 | } 19 | -------------------------------------------------------------------------------- /oadr/oadr/scheduler/IJob.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IJob.h 3 | * 4 | * Created on: Oct 5, 2014 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef IJOB_H_ 9 | #define IJOB_H_ 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | using namespace std; 17 | 18 | class IJob 19 | { 20 | private: 21 | 22 | public: 23 | IJob(); 24 | virtual ~IJob(); 25 | 26 | virtual void execute(time_t now) = 0; 27 | }; 28 | 29 | #endif /* IJOB_H_ */ 30 | -------------------------------------------------------------------------------- /oadr/oadr/scheduler/IScheduler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * IScheduler.cpp 3 | * 4 | * Created on: Jun 22, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "IScheduler.h" 9 | 10 | IScheduler::IScheduler() 11 | { 12 | } 13 | 14 | IScheduler::~IScheduler() 15 | { 16 | } 17 | 18 | -------------------------------------------------------------------------------- /oadr/oadr/scheduler/IScheduler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IScheduler.h 3 | * 4 | * Created on: Jun 22, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_VEN_VENMANAGER_SCHEDULER_ISCHEDULER_H_ 9 | #define OADR_OADR_VEN_VENMANAGER_SCHEDULER_ISCHEDULER_H_ 10 | 11 | #include "SchedulerJob.h" 12 | 13 | #include "../helper/thread/IRun.h" 14 | 15 | #include 16 | #include 17 | 18 | using namespace std; 19 | 20 | class IScheduler : public IRun 21 | { 22 | public: 23 | IScheduler(); 24 | virtual ~IScheduler(); 25 | 26 | virtual bool addJob(unique_ptr schedulerJob) = 0; 27 | virtual bool removeJob(string schedulerJobID) = 0; 28 | 29 | virtual void executeNext() = 0; 30 | 31 | virtual size_t getNumScheduledJobs() = 0; 32 | }; 33 | 34 | #endif /* OADR_OADR_VEN_VENMANAGER_SCHEDULER_ISCHEDULER_H_ */ 35 | -------------------------------------------------------------------------------- /oadr/oadr/scheduler/JobLambda.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * JobLambda.cpp 3 | * 4 | * Created on: Jul 7, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "JobLambda.h" 9 | 10 | JobLambda::JobLambda(const std::function &function) : 11 | m_function(function) 12 | { 13 | } 14 | 15 | /********************************************************************************/ 16 | 17 | JobLambda::~JobLambda() 18 | { 19 | 20 | } 21 | 22 | /********************************************************************************/ 23 | 24 | void JobLambda::execute(time_t now) 25 | { 26 | m_function(now); 27 | } 28 | -------------------------------------------------------------------------------- /oadr/oadr/scheduler/JobLambda.h: -------------------------------------------------------------------------------- 1 | /* 2 | * JobLambda.h 3 | * 4 | * Created on: Jul 7, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_SCHEDULER_JOBLAMBDA_H_ 9 | #define OADR_OADR_SCHEDULER_JOBLAMBDA_H_ 10 | 11 | #include "IJob.h" 12 | 13 | #include 14 | 15 | class JobLambda : public IJob 16 | { 17 | private: 18 | std::function m_function; 19 | 20 | public: 21 | JobLambda(const std::function &function); 22 | 23 | virtual ~JobLambda(); 24 | 25 | virtual void execute(time_t now); 26 | }; 27 | 28 | #endif /* OADR_OADR_SCHEDULER_JOBLAMBDA_H_ */ 29 | -------------------------------------------------------------------------------- /oadr/oadr/scheduler/Scheduler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Scheduler.h 3 | * 4 | * Created on: Oct 5, 2014 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef SCHEDULER_H_ 9 | #define SCHEDULER_H_ 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #include 23 | 24 | #include "../helper/conditionalsleep/ConditionalSleep.h" 25 | #include "../helper/globaltime/GlobalTime.h" 26 | 27 | #include "SchedulerJobs.h" 28 | #include "IScheduler.h" 29 | 30 | using namespace std; 31 | using namespace std::chrono; 32 | 33 | class Scheduler : public IScheduler 34 | { 35 | private: 36 | shared_ptr m_schedulerJobs; 37 | shared_ptr m_conditionalSleep; 38 | 39 | mutex m_mutex; 40 | 41 | bool m_shutdown; 42 | 43 | void sortJobs(); 44 | 45 | void execute(time_t runtime); 46 | 47 | virtual bool removeJobInternal(string schedulerJobID); 48 | 49 | public: 50 | Scheduler(shared_ptr conditionalSleep = shared_ptr(new ConditionalSleep())); 51 | virtual ~Scheduler(); 52 | 53 | virtual size_t getNumScheduledJobs(); 54 | 55 | virtual bool addJob(unique_ptr schedulerJob); 56 | virtual bool removeJob(string schedulerJobID); 57 | 58 | virtual void executeNext(); 59 | 60 | // TODO: remove these. they're only exposed to 61 | // allow unit tests to examine internal state 62 | map> &jobMap(); 63 | list &jobList(); 64 | 65 | virtual void run(); 66 | virtual void stop(); 67 | 68 | void visitJobs(std::function callback); 69 | }; 70 | 71 | #endif /* SCHEDULER_H_ */ 72 | -------------------------------------------------------------------------------- /oadr/oadr/scheduler/SchedulerJobs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SchedulerJobs.h 3 | * 4 | * Created on: Jun 25, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_SCHEDULER_SCHEDULERJOBS_H_ 9 | #define OADR_OADR_SCHEDULER_SCHEDULERJOBS_H_ 10 | 11 | #include "SchedulerJob.h" 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | using namespace std; 19 | 20 | class SchedulerJobs 21 | { 22 | private: 23 | map> m_idToSchedule; 24 | list m_schedule; 25 | 26 | public: 27 | SchedulerJobs(); 28 | virtual ~SchedulerJobs(); 29 | 30 | bool addJob(unique_ptr schedulerJob); 31 | bool removeJob(string schedulerJobID); 32 | 33 | void sort(); 34 | 35 | SchedulerJob *front(); 36 | 37 | void rotate(); 38 | 39 | size_t size(); 40 | 41 | map> &jobMap(); 42 | list &jobList(); 43 | }; 44 | 45 | #endif /* OADR_OADR_SCHEDULER_SCHEDULERJOBS_H_ */ 46 | -------------------------------------------------------------------------------- /oadr/oadr/ven/IOadrMessage.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * IOadrMessage.cpp 3 | * 4 | * Created on: Jul 9, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "IOadrMessage.h" 9 | 10 | /********************************************************************************/ 11 | 12 | OadrMessageBlank OadrMessageBlank::oadrMessageBlank; 13 | 14 | /********************************************************************************/ 15 | 16 | IOadrMessage::IOadrMessage() 17 | { 18 | } 19 | 20 | /********************************************************************************/ 21 | 22 | IOadrMessage::~IOadrMessage() 23 | { 24 | } 25 | 26 | 27 | -------------------------------------------------------------------------------- /oadr/oadr/ven/IOadrMessage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IOadrMessage.h 3 | * 4 | * Created on: Jul 9, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADR_OADR_VEN_IOADRMESSAGE_H_ 9 | #define OADR_OADR_VEN_IOADRMESSAGE_H_ 10 | 11 | #include 12 | 13 | class IOadrMessage 14 | { 15 | public: 16 | IOadrMessage(); 17 | virtual ~IOadrMessage(); 18 | 19 | virtual void OnOadrMessageReceived(std::string &message) = 0; 20 | virtual void OnOadrMessageSent(std::string &message) = 0; 21 | }; 22 | 23 | class OadrMessageBlank : public IOadrMessage 24 | { 25 | public: 26 | virtual void OnOadrMessageReceived(std::string &message){}; 27 | virtual void OnOadrMessageSent(std::string &message){}; 28 | 29 | static OadrMessageBlank oadrMessageBlank; 30 | }; 31 | 32 | #endif /* OADR_OADR_VEN_IOADRMESSAGE_H_ */ 33 | -------------------------------------------------------------------------------- /oadrsd/.gitignore: -------------------------------------------------------------------------------- 1 | /Debug 2 | /Release 3 | /mac-Debug 4 | -------------------------------------------------------------------------------- /oadrsd/SConscript: -------------------------------------------------------------------------------- 1 | import glob 2 | import os 3 | import sconsHelper 4 | 5 | Import('cflags buildmode') 6 | 7 | cppPath = ['../xsd-4.0.0'] 8 | libDir = [] 9 | libs = ['xerces-c'] 10 | 11 | sconsHelper.build('oadrsd', cppPath, cflags, libDir, libs, buildmode, "shared") 12 | 13 | -------------------------------------------------------------------------------- /oadrsd/oadrsd/schema/oadr_emix_20b.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A URI identifying a DR Program 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | The Service Area is the geographic region that is affected by the EMIX market condition 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | Abstract base type for units for EMIX Product delivery, measurement, and warrants. 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /oadrsd/oadrsd/schema/oadr_gml_20b.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /oadrsd/oadrsd/schema/oadr_xmldsig-properties-schema.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /oadrtest/.gitignore: -------------------------------------------------------------------------------- 1 | /Debug 2 | /Release 3 | /mac-Debug 4 | /Debug 5 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/expected_output/currency_actual.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | currency 5 | 6 | AED 7 | 8 | p 9 | 10 | 11 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/expected_output/currency_per_kw_actual.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | currency 5 | 6 | AED 7 | 8 | p 9 | 10 | 11 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/expected_output/currency_per_kwh.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | currency 21 | AED 22 | p 23 | 24 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/expected_output/currency_per_kwh_actual.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | currency 5 | 6 | AED 7 | 8 | p 9 | 10 | 11 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/expected_output/request_event1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | requestID 8 | venid 9 | 22 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/expected_output/update_report2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | request_id 7 | 8 | 9 | report_request_id 10 | report_spec_1 11 | TELEMETRY_STATUS 12 | 2013-12-30T16:19:58Z 13 | 14 | 15 | 16 | report_request_id 17 | report_spec_2 18 | TELEMETRY_USAGE 19 | 2013-12-30T16:19:58Z 20 | 21 | 22 | 23 | report_request_id 24 | report_spec_3 25 | HISTORY_USAGE 26 | 2013-12-30T16:19:58Z 27 | 28 | ven_id 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/helper/MockGlobalIncrementingTime.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * MockGlobalIncrementingTime.cpp 3 | * 4 | * Created on: Jun 26, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "MockGlobalIncrementingTime.h" 9 | 10 | MockGlobalIncrementingTime::MockGlobalIncrementingTime() 11 | { 12 | m_now = 0; 13 | m_offset = 0; 14 | } 15 | 16 | /********************************************************************************/ 17 | 18 | MockGlobalIncrementingTime::~MockGlobalIncrementingTime() 19 | { 20 | } 21 | 22 | /********************************************************************************/ 23 | 24 | time_t MockGlobalIncrementingTime::now() 25 | { 26 | return time(NULL) + m_offset; 27 | } 28 | 29 | /********************************************************************************/ 30 | 31 | void MockGlobalIncrementingTime::setNow(time_t now) 32 | { 33 | m_now = now; 34 | 35 | m_offset = m_now - time(NULL); 36 | } 37 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/helper/MockGlobalIncrementingTime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MockGlobalIncrementingTime.h 3 | * 4 | * Created on: Jun 26, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADRTEST_OADRTEST_HELPER_MOCKGLOBALINCREMENTINGTIME_H_ 9 | #define OADRTEST_OADRTEST_HELPER_MOCKGLOBALINCREMENTINGTIME_H_ 10 | 11 | #include 12 | 13 | class MockGlobalIncrementingTime : public IGlobalTime 14 | { 15 | private: 16 | time_t m_now; 17 | long int m_offset; 18 | 19 | public: 20 | MockGlobalIncrementingTime(); 21 | virtual ~MockGlobalIncrementingTime(); 22 | 23 | virtual time_t now(); 24 | 25 | void setNow(time_t now); 26 | }; 27 | 28 | #endif /* OADRTEST_OADRTEST_HELPER_MOCKGLOBALINCREMENTINGTIME_H_ */ 29 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/helper/MockGlobalTime.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * MockGlobalTime.cpp 3 | * 4 | * Created on: Jun 25, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "MockGlobalTime.h" 9 | 10 | #include 11 | 12 | MockGlobalTime::MockGlobalTime() : 13 | m_now(0) 14 | { 15 | GlobalTime::SetGlobalTime(this); 16 | } 17 | 18 | /********************************************************************************/ 19 | 20 | MockGlobalTime::~MockGlobalTime() 21 | { 22 | GlobalTime::SetDefaultGlobalTime(); 23 | } 24 | 25 | /********************************************************************************/ 26 | 27 | time_t MockGlobalTime::now() 28 | { 29 | return m_now; 30 | } 31 | 32 | /********************************************************************************/ 33 | 34 | void MockGlobalTime::setNow(time_t now) 35 | { 36 | m_now = now; 37 | } 38 | 39 | /********************************************************************************/ 40 | 41 | void MockGlobalTime::setNow(int year, int month, int day, int hours, int minutes, int seconds) 42 | { 43 | tm t; 44 | 45 | memset(&t, 0, sizeof(t)); 46 | 47 | t.tm_year = year - 1900; 48 | t.tm_mon = month - 1; 49 | t.tm_mday = day; 50 | t.tm_hour = hours; 51 | t.tm_min = minutes; 52 | t.tm_sec = seconds; 53 | 54 | m_now = mktime(&t); 55 | } 56 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/helper/MockGlobalTime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MockGlobalTime.h 3 | * 4 | * Created on: Jun 25, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADRTEST_OADRTEST_HELPER_MOCKGLOBALTIME_H_ 9 | #define OADRTEST_OADRTEST_HELPER_MOCKGLOBALTIME_H_ 10 | 11 | #include 12 | 13 | class MockGlobalTime : public IGlobalTime 14 | { 15 | private: 16 | time_t m_now; 17 | 18 | public: 19 | MockGlobalTime(); 20 | virtual ~MockGlobalTime(); 21 | 22 | virtual time_t now(); 23 | 24 | void setNow(time_t now); 25 | 26 | void setNow(int year, int month, int day, int hours, int minutes, int seconds); 27 | }; 28 | 29 | #endif /* OADRTEST_OADRTEST_HELPER_MOCKGLOBALTIME_H_ */ 30 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/helper/MockScheduler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * MockScheduler.cpp 3 | * 4 | * Created on: Jun 22, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "MockScheduler.h" 9 | 10 | MockScheduler::MockScheduler() 11 | { 12 | AddJobCalledCount = 0; 13 | RemoveJobCalledCount = 0; 14 | } 15 | 16 | /********************************************************************************/ 17 | 18 | MockScheduler::~MockScheduler() 19 | { 20 | } 21 | 22 | /********************************************************************************/ 23 | 24 | bool MockScheduler::addJob(unique_ptr schedulerJob) 25 | { 26 | AddJobCalledCount++; 27 | 28 | scheduleIDs.insert(schedulerJob->getID()); 29 | 30 | return true; 31 | } 32 | 33 | /********************************************************************************/ 34 | 35 | bool MockScheduler::removeJob(string schedulerJobID) 36 | { 37 | RemoveJobCalledCount++; 38 | 39 | removedScheduleIDs.push_back(schedulerJobID); 40 | 41 | if (scheduleIDs.erase(schedulerJobID) > 0) 42 | return true; 43 | 44 | return false; 45 | } 46 | 47 | /********************************************************************************/ 48 | 49 | void MockScheduler::executeNext() 50 | { 51 | 52 | } 53 | 54 | /********************************************************************************/ 55 | 56 | size_t MockScheduler::getNumScheduledJobs() 57 | { 58 | return scheduleIDs.size(); 59 | } 60 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/helper/MockScheduler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MockScheduler.h 3 | * 4 | * Created on: Jun 22, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADRTEST_OADRTEST_HELPER_MOCKSCHEDULER_H_ 9 | #define OADRTEST_OADRTEST_HELPER_MOCKSCHEDULER_H_ 10 | 11 | #include 12 | 13 | #include 14 | 15 | using namespace std; 16 | 17 | class MockScheduler : public IScheduler 18 | { 19 | 20 | public: 21 | MockScheduler(); 22 | virtual ~MockScheduler(); 23 | 24 | virtual bool addJob(unique_ptr schedulerJob); 25 | virtual bool removeJob(string schedulerJobID); 26 | 27 | virtual void executeNext(); 28 | 29 | virtual size_t getNumScheduledJobs(); 30 | 31 | virtual void run() {}; 32 | virtual void stop() {}; 33 | 34 | set scheduleIDs; 35 | 36 | list removedScheduleIDs; 37 | 38 | size_t AddJobCalledCount; 39 | size_t RemoveJobCalledCount; 40 | }; 41 | 42 | #endif /* OADRTEST_OADRTEST_HELPER_MOCKSCHEDULER_H_ */ 43 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/test_input/currency.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | currency 21 | AED 22 | p 23 | 24 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/test_input/currency1.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | currency 21 | AED 22 | p 23 | 24 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/test_input/currency_per_kw.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | currencyPerKW 21 | AED 22 | p 23 | 24 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/test_input/currency_per_kw1.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | currency 21 | AED 22 | p 23 | 24 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/test_input/currency_per_kwh.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | currencyPerKWh 21 | AED 22 | p 23 | 24 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/test_input/payload/cancel_report-no-report_to_follow.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | e3287c948fc00dcd40ca 6 | d41628197365b70b3e23 7 | false 8 | b5f74feb5a3d4640f1b9 9 | 10 | 11 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/test_input/payload/cancel_report-w-report_to_follow.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | e3287c948fc00dcd40ca 6 | d41628197365b70b3e23 7 | true 8 | b5f74feb5a3d4640f1b9 9 | 10 | 11 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/test_input/payload/create_report-oneshot.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 766218714e6aa850fe3e 6 | 7 | 8cc9aa100dfa963a3c17 8 | 9 | 789ed6cd4e_telemetry_status 10 | 11 | PT0M 12 | 13 | 14 | PT0M 15 | 16 | 17 | resource1_status 18 | x-notApplicable 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/test_input/payload/create_report-oneshot_invalid.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 766218714e6aa850fe3e 6 | 7 | 8cc9aa100dfa963a3c17 8 | 9 | 789ed6cd4e_telemetry_status 10 | 11 | PT0M 12 | 13 | 14 | PT0M 15 | 16 | 17 | resource1_status_invalid 18 | x-notApplicable 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/test_input/payload/create_report-periodic-zero-duration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | e3287c948fc00dcd40ca 6 | 7 | d41628197365b70b3e23 8 | 9 | 789ed6cd4e_telemetry_usage 10 | 11 | PT1M 12 | 13 | 14 | PT2M 15 | 16 | 17 | 18 | 19 | 2014-12-02T18:20:22Z 20 | 21 | 22 | PT0M 23 | 24 | 25 | 26 | 27 | resource1_energy 28 | x-notApplicable 29 | 30 | 31 | resource1_power 32 | x-notApplicable 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/test_input/payload/create_report-periodic.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | e3287c948fc00dcd40ca 6 | 7 | d41628197365b70b3e23 8 | 9 | 789ed6cd4e_telemetry_usage 10 | 11 | PT1M 12 | 13 | 14 | PT2M 15 | 16 | 17 | 18 | 19 | 2014-12-02T18:20:22Z 20 | 21 | 22 | PT10M 23 | 24 | 25 | 26 | 27 | resource1_energy 28 | x-notApplicable 29 | 30 | 31 | resource1_power 32 | x-notApplicable 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/test_input/test_buffer1.txt: -------------------------------------------------------------------------------- 1 | HTTP/1.1 200 OK 2 | Server: Apache-Coyote/1.1 3 | X-UA-Compatible: IE=Edge 4 | ETag: "ce9fc5cb1bdd952d0b00d904ca96dac4" 5 | Cache-Control: max-age=0, private, must-revalidate 6 | Set-Cookie: _oadr_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRkkiJTI1OTRiMDAwYzI1YjJhNjY4MzkwMjhiOTZmZDdjYzNmBjsAVA%3D%3D--7e20313fa96bcbd9f835f1896ab0c1b86d741407; path=/; HttpOnly 7 | Set-Cookie: oadr_remember_token=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT 8 | X-Request-Id: 4dfcd3f89f5f2652b0803062a73c38f3 9 | X-Runtime: 0.073000 10 | Content-Type: application/xml;charset=utf-8 11 | Content-Length: 1308 12 | Date: Fri, 20 Dec 2013 07:30:46 GMT 13 | 14 | 15 | 16 | 17 | 18 | 19 | 452 20 | Invalid ID 21 | F3379C25CB 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/test_input/test_buffer2.txt: -------------------------------------------------------------------------------- 1 | HTTP/1.1 404 Not Found 2 | Date: Tue, 09 Dec 2014 20:09:35 GMT 3 | Server: Apache/2.2.22 (Ubuntu) 4 | Vary: Accept-Encoding 5 | Content-Length: 288 6 | Content-Type: text/html; charset=iso-8859-1 7 | 8 | 9 | 10 | 404 Not Found 11 | 12 |

Not Found

13 |

The requested URL /EiRegisterParty was not found on this server.

14 |
15 |
Apache/2.2.22 (Ubuntu) Server at localhost Port 80
16 | 17 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/test_input/test_parser1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 452 7 | Invalid ID 8 | A40A878C91 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/tests/eventmanager/BlankEventService.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MockEventService.h 3 | * 4 | * Created on: Jun 22, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADRTEST_OADRTEST_TESTS_EVENTMANAGER_BLANKEVENTSERVICE_H_ 9 | #define OADRTEST_OADRTEST_TESTS_EVENTMANAGER_BLANKEVENTSERVICE_H_ 10 | 11 | #include 12 | 13 | class BlankEventService : public IEventService 14 | { 15 | public: 16 | BlankEventService(); 17 | virtual ~BlankEventService(); 18 | 19 | virtual void OnEventStart(const std::string &eventID, const oadr2b::oadr::oadrEvent *event, unsigned int remainingDurationInSeconds); 20 | virtual void OnEventComplete(const std::string &eventID, const oadr2b::oadr::oadrEvent *event); 21 | virtual void OnEventIntervalStart(const std::string &eventID, const oadr2b::oadr::oadrEvent *event, const oadr2b::ei::eiEventSignalType *eventSignal, std::string uid, float payload, time_t dtstart, unsigned int remainingDurationInSeconds); 22 | 23 | virtual void OnEventNew(const std::string &eventID, const oadr2b::oadr::oadrEvent *event, oadr2b::ei::OptTypeType::value &optType); 24 | virtual void OnEventModify(const std::string &eventID, const oadr2b::oadr::oadrEvent *newEvent, const oadr2b::oadr::oadrEvent *oldEvent, oadr2b::ei::OptTypeType::value &optType); 25 | virtual void OnEventCancel(const std::string &eventID, const oadr2b::oadr::oadrEvent *event, oadr2b::ei::OptTypeType::value &optType); 26 | virtual void OnEventImplicitCancel(const std::string &eventID, const oadr2b::oadr::oadrEvent *event); 27 | 28 | unsigned int OnStartCount; 29 | unsigned int OnCompleteCount; 30 | unsigned int OnIntervalStartCount; 31 | 32 | unsigned int OnNewCount; 33 | unsigned int OnModifyCount; 34 | unsigned int OnCancelCount; 35 | unsigned int OnImplicitCancelCount; 36 | 37 | bool OnNewCalledFirst; 38 | 39 | unsigned int remainingDuration; 40 | unsigned int remainingIntervalDuration; 41 | }; 42 | 43 | #endif /* OADRTEST_OADRTEST_TESTS_EVENTMANAGER_BLANKEVENTSERVICE_H_ */ 44 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/tests/eventmanager/BlankSendCreatedEvent.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BlankSendCreatedEvent.cpp 3 | * 4 | * Created on: Jul 7, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "BlankSendCreatedEvent.h" 9 | 10 | BlankSendCreatedEvent::BlankSendCreatedEvent() 11 | { 12 | SendCreatedEventCount = 0; 13 | EventResponseCount = 0; 14 | } 15 | 16 | /********************************************************************************/ 17 | 18 | BlankSendCreatedEvent::~BlankSendCreatedEvent() 19 | { 20 | } 21 | 22 | /********************************************************************************/ 23 | 24 | void BlankSendCreatedEvent::sendCreatedEvent(string responseCode, string responseDescription, string requestID, oadr2b::ei::eventResponses::eventResponse_sequence &eventResponses) 25 | { 26 | SendCreatedEventCount++; 27 | 28 | EventResponseCount = eventResponses.size(); 29 | } 30 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/tests/eventmanager/BlankSendCreatedEvent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * BlankSendCreatedEvent.h 3 | * 4 | * Created on: Jul 7, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADRTEST_OADRTEST_TESTS_EVENTMANAGER_BLANKSENDCREATEDEVENT_H_ 9 | #define OADRTEST_OADRTEST_TESTS_EVENTMANAGER_BLANKSENDCREATEDEVENT_H_ 10 | 11 | #include 12 | 13 | class BlankSendCreatedEvent : public ISendCreatedEvent 14 | { 15 | public: 16 | BlankSendCreatedEvent(); 17 | virtual ~BlankSendCreatedEvent(); 18 | 19 | virtual void sendCreatedEvent(string responseCode, string responseDescription, string requestID, oadr2b::ei::eventResponses::eventResponse_sequence &eventResponses); 20 | 21 | unsigned int SendCreatedEventCount; 22 | 23 | size_t EventResponseCount; 24 | }; 25 | 26 | #endif /* OADRTEST_OADRTEST_TESTS_EVENTMANAGER_BLANKSENDCREATEDEVENT_H_ */ 27 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/tests/eventmanager/CreateEventHelper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CreateEventHelper.h 3 | * 4 | * Created on: Jun 26, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADRTEST_OADRTEST_TESTS_EVENTMANAGER_CREATEEVENTHELPER_H_ 9 | #define OADRTEST_OADRTEST_TESTS_EVENTMANAGER_CREATEEVENTHELPER_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | #include 18 | 19 | #include 20 | 21 | using namespace oadr2b::oadr; 22 | using namespace oadr2b::ei; 23 | using namespace oadr2b::emix; 24 | using namespace std; 25 | 26 | class CreateEventHelper 27 | { 28 | public: 29 | CreateEventHelper(); 30 | virtual ~CreateEventHelper(); 31 | 32 | static oadrEvent::eiEvent_type::eventDescriptor_type *CreateEventDescriptor(string eventID, unsigned int modificationNumber, 33 | string marketContext, time_t createdAt, EventStatusEnumeratedType status); 34 | 35 | static oadr2b::oadr::oadrEvent *CreateEvent(time_t dtstart, int duration, std::string eventID); 36 | }; 37 | 38 | #endif /* OADRTEST_OADRTEST_TESTS_EVENTMANAGER_CREATEEVENTHELPER_H_ */ 39 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/tests/reportmanager/BlankReportService.h: -------------------------------------------------------------------------------- 1 | /* 2 | * BlankReportService.h 3 | * 4 | * Created on: Jul 6, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADRTEST_OADRTEST_TESTS_REPORTMANAGER_BLANKREPORTSERVICE_H_ 9 | #define OADRTEST_OADRTEST_TESTS_REPORTMANAGER_BLANKREPORTSERVICE_H_ 10 | 11 | #include 12 | 13 | class BlankReportService : public IReportService 14 | { 15 | public: 16 | BlankReportService(); 17 | virtual ~BlankReportService(); 18 | 19 | virtual void OnPeriodicReportStart(const oadrReportRequestType &reportRequest); 20 | 21 | virtual void OnPeriodicReportComplete(const oadrReportRequestType &reportRequest); 22 | 23 | virtual void OnGenerateOneshotReport(const oadrReportRequestType &reportRequest, oadrUpdateReportType::oadrReport_sequence &sequence); 24 | 25 | virtual void OnGeneratePeriodicReport(const oadrReportRequestType &reportRequest, oadrUpdateReportType::oadrReport_sequence &sequence, time_t dtstart, 26 | unsigned int durationInSeconds); 27 | 28 | virtual void OnGenerateHistoricalReport(const oadrReportRequestType &reportRequest, oadrUpdateReportType::oadrReport_sequence &sequence, time_t dtstart, 29 | unsigned int durationInSeconds); 30 | 31 | virtual void OnGenerateRegisterReport(oadrRegisterReportType::oadrReport_sequence &sequence); 32 | 33 | unsigned int OneshotReportCount; 34 | unsigned int PeriodicReportCount; 35 | unsigned int HistoricalReportCount; 36 | 37 | unsigned int PeriodicReportStartCount; 38 | unsigned int PeriodicReportCompleteCount; 39 | }; 40 | 41 | #endif /* OADRTEST_OADRTEST_TESTS_REPORTMANAGER_BLANKREPORTSERVICE_H_ */ 42 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/tests/reportmanager/BlankSendReport.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BlankSendReport.cpp 3 | * 4 | * Created on: Jul 6, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "BlankSendReport.h" 9 | 10 | BlankSendReport::BlankSendReport() 11 | { 12 | SendUpdateReportCount = 0; 13 | SendCreatedReportCount = 0; 14 | PendingReportSize = 0; 15 | SendCanceledReportCount = 0; 16 | } 17 | 18 | /********************************************************************************/ 19 | 20 | BlankSendReport::~BlankSendReport() 21 | { 22 | } 23 | 24 | /********************************************************************************/ 25 | 26 | void BlankSendReport::sendUpdateReport(oadrUpdateReportType::oadrReport_sequence &sequence, time_t dtstart, string reportRequestID, time_t createdDateTime) 27 | { 28 | SendUpdateReportCount++; 29 | } 30 | 31 | /********************************************************************************/ 32 | 33 | void BlankSendReport::sendCreatedReport(const set &pendingReports, string requestID, string responseCode, string responseDescription) 34 | { 35 | ResponseCode = responseCode; 36 | ResponseDescription = responseDescription; 37 | 38 | PendingReportSize = pendingReports.size(); 39 | 40 | SendCreatedReportCount++; 41 | } 42 | 43 | /********************************************************************************/ 44 | 45 | void BlankSendReport::sendCanceledReport(const set &pendingReports, string requestID, string responseCode, string responseDescription) 46 | { 47 | SendCanceledReportCount++; 48 | } 49 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/tests/reportmanager/BlankSendReport.h: -------------------------------------------------------------------------------- 1 | /* 2 | * BlankSendReport.h 3 | * 4 | * Created on: Jul 6, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADRTEST_OADRTEST_TESTS_REPORTMANAGER_BLANKSENDREPORT_H_ 9 | #define OADRTEST_OADRTEST_TESTS_REPORTMANAGER_BLANKSENDREPORT_H_ 10 | 11 | #include 12 | 13 | class BlankSendReport : public ISendReport 14 | { 15 | public: 16 | BlankSendReport(); 17 | virtual ~BlankSendReport(); 18 | 19 | virtual void sendUpdateReport(oadrUpdateReportType::oadrReport_sequence &sequence, time_t dtstart, string reportRequestID, time_t createdDateTime); 20 | 21 | virtual void sendCreatedReport(const set &pendingReports, string requestID, string responseCode, string responseDescription); 22 | 23 | virtual void sendCanceledReport(const set &pendingReports, string requestID, string responseCode, string responseDescription); 24 | 25 | unsigned int SendUpdateReportCount; 26 | unsigned int SendCreatedReportCount; 27 | unsigned int SendCanceledReportCount; 28 | 29 | unsigned int PendingReportSize; 30 | 31 | string ResponseCode; 32 | string ResponseDescription; 33 | }; 34 | 35 | #endif /* OADRTEST_OADRTEST_TESTS_REPORTMANAGER_BLANKSENDREPORT_H_ */ 36 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/tests/scheduler/JobException.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * JobException.cpp 3 | * 4 | * Created on: Dec 10, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "JobException.h" 9 | 10 | JobException::JobException() 11 | { 12 | } 13 | 14 | /********************************************************************************/ 15 | 16 | JobException::~JobException() 17 | { 18 | } 19 | 20 | /********************************************************************************/ 21 | 22 | void JobException::execute(time_t now) 23 | { 24 | throw std::runtime_error("JobException::execute : something bad happened"); 25 | } 26 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/tests/scheduler/JobException.h: -------------------------------------------------------------------------------- 1 | /* 2 | * JobException.h 3 | * 4 | * Created on: Dec 10, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADRTEST_OADRTEST_TESTS_SCHEDULER_JOBEXCEPTION_H_ 9 | #define OADRTEST_OADRTEST_TESTS_SCHEDULER_JOBEXCEPTION_H_ 10 | 11 | #include 12 | #include 13 | 14 | class JobException: public IJob 15 | { 16 | public: 17 | JobException(); 18 | virtual ~JobException(); 19 | 20 | virtual void execute(time_t now); 21 | }; 22 | 23 | #endif /* OADRTEST_OADRTEST_TESTS_SCHEDULER_JOBEXCEPTION_H_ */ 24 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/tests/scheduler/JobNull.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * JobNull.cpp 3 | * 4 | * Created on: Mar 11, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "JobNull.h" 9 | 10 | JobNull::JobNull(int *executeCalledCount) 11 | { 12 | if (executeCalledCount != NULL) 13 | { 14 | m_executeCalledCount = executeCalledCount; 15 | } 16 | else 17 | { 18 | m_executeCalledCount = &m_internalExecuteCalledCount; 19 | } 20 | 21 | m_internalExecuteCalledCount = 0; 22 | } 23 | 24 | /********************************************************************************/ 25 | 26 | JobNull::~JobNull() 27 | { 28 | } 29 | 30 | /********************************************************************************/ 31 | 32 | void JobNull::execute(time_t t) 33 | { 34 | (*m_executeCalledCount)++; 35 | } 36 | 37 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/tests/scheduler/JobNull.h: -------------------------------------------------------------------------------- 1 | /* 2 | * JobNull.h 3 | * 4 | * Created on: Mar 11, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADRTEST_OADRTEST_TESTS_SCHEDULER_JOBNULL_H_ 9 | #define OADRTEST_OADRTEST_TESTS_SCHEDULER_JOBNULL_H_ 10 | 11 | #include 12 | 13 | class JobNull : public IJob 14 | { 15 | private: 16 | int *m_executeCalledCount; 17 | 18 | int m_internalExecuteCalledCount; 19 | public: 20 | JobNull(int *executeCalledCount = NULL); 21 | virtual ~JobNull(); 22 | 23 | virtual void execute(time_t t); 24 | }; 25 | 26 | #endif /* OADRTEST_OADRTEST_TESTS_SCHEDULER_JOBNULL_H_ */ 27 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/tests/scheduler/JobSlow.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by dupes on 12/9/15. 3 | // 4 | 5 | #include "JobSlow.h" 6 | 7 | 8 | JobSlow::JobSlow(MockGlobalTime *globalTime) : 9 | m_globalTime(globalTime) 10 | { 11 | } 12 | 13 | /********************************************************************************/ 14 | 15 | JobSlow::~JobSlow() 16 | { 17 | } 18 | 19 | /********************************************************************************/ 20 | 21 | void JobSlow::execute(time_t now) 22 | { 23 | m_globalTime->setNow(now + 200); 24 | } 25 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/tests/scheduler/JobSlow.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by dupes on 12/9/15. 3 | // 4 | 5 | #ifndef OADR_JOBSLOW_H 6 | #define OADR_JOBSLOW_H 7 | 8 | #include "../../helper/MockGlobalTime.h" 9 | 10 | #include 11 | 12 | class JobSlow : public IJob 13 | { 14 | private: 15 | MockGlobalTime *m_globalTime; 16 | 17 | public: 18 | JobSlow(MockGlobalTime *globalTime); 19 | ~JobSlow(); 20 | 21 | virtual void execute(time_t now); 22 | }; 23 | 24 | 25 | #endif //OADR_JOBSLOW_H 26 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/tests/scheduler/MockConditionalSleep.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * MockSleepTimer.cpp 3 | * 4 | * Created on: Jun 25, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #include "MockConditionalSleep.h" 9 | 10 | MockConditionalSleep::MockConditionalSleep(MockGlobalTime *globalTime) : 11 | m_globalTime(globalTime), 12 | m_timeoutOccurred(true), 13 | m_waitUntilTime(0) 14 | { 15 | } 16 | 17 | /********************************************************************************/ 18 | 19 | MockConditionalSleep::~MockConditionalSleep() 20 | { 21 | } 22 | 23 | /********************************************************************************/ 24 | 25 | bool MockConditionalSleep::waitUntil(std::unique_lock &lock, time_t t) 26 | { 27 | m_waitUntilTime = t; 28 | 29 | if (m_globalTime != NULL) 30 | m_globalTime->setNow(t); 31 | 32 | return m_timeoutOccurred; 33 | } 34 | 35 | /********************************************************************************/ 36 | 37 | bool MockConditionalSleep::waitFor(std::unique_lock &lock, std::chrono::seconds s) 38 | { 39 | if (m_globalTime != NULL) 40 | m_globalTime->setNow(m_globalTime->now() + s.count()); 41 | 42 | return m_timeoutOccurred; 43 | } 44 | 45 | /********************************************************************************/ 46 | 47 | void MockConditionalSleep::notifyOne() 48 | { 49 | 50 | } 51 | 52 | /********************************************************************************/ 53 | 54 | void MockConditionalSleep::notifyAll() 55 | { 56 | 57 | } 58 | 59 | /********************************************************************************/ 60 | 61 | void MockConditionalSleep::setTimeoutOccurred(bool timeoutOccurred) 62 | { 63 | m_timeoutOccurred = timeoutOccurred; 64 | } 65 | 66 | /********************************************************************************/ 67 | 68 | time_t MockConditionalSleep::getWaitUntilTime() 69 | { 70 | return m_waitUntilTime; 71 | } 72 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/tests/scheduler/MockConditionalSleep.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MockSleepTimer.h 3 | * 4 | * Created on: Jun 25, 2015 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADRTEST_OADRTEST_TESTS_SCHEDULER_MOCKCONDITIONALSLEEP_H_ 9 | #define OADRTEST_OADRTEST_TESTS_SCHEDULER_MOCKCONDITIONALSLEEP_H_ 10 | 11 | #include 12 | 13 | #include "../../helper/MockGlobalTime.h" 14 | 15 | class MockConditionalSleep : public IConditionalSleep 16 | { 17 | private: 18 | MockGlobalTime *m_globalTime; 19 | 20 | bool m_timeoutOccurred; 21 | 22 | time_t m_waitUntilTime; 23 | 24 | public: 25 | MockConditionalSleep(MockGlobalTime *globalTime = NULL); 26 | virtual ~MockConditionalSleep(); 27 | 28 | virtual bool waitUntil(std::unique_lock &lock, time_t t); 29 | virtual bool waitFor(std::unique_lock &lock, std::chrono::seconds s); 30 | virtual void notifyOne(); 31 | virtual void notifyAll(); 32 | 33 | void setTime(time_t t); 34 | void setTimeoutOccurred(bool stimeoutOccurred); 35 | 36 | time_t getWaitUntilTime(); 37 | }; 38 | 39 | #endif /* OADRTEST_OADRTEST_TESTS_SCHEDULER_MOCKCONDITIONALSLEEP_H_ */ 40 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/tests/ven/MockHttp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * MockHttp.cpp 3 | * 4 | * Created on: May 17, 2016 5 | * Author: dupes 6 | */ 7 | 8 | #include "MockHttp.h" 9 | 10 | MockHttp::MockHttp() 11 | { 12 | m_responseCode = "200"; 13 | m_responseMessage = "OK"; 14 | } 15 | 16 | MockHttp::~MockHttp() 17 | { 18 | } 19 | 20 | bool MockHttp::post(string url, string content) 21 | { 22 | m_requestBody = content; 23 | 24 | return true; 25 | } 26 | 27 | void MockHttp::setParameters(string clientCertificatePath, 28 | string clientPrivateKeyPath, string certificateAuthorityBundlePath, 29 | bool verifyCertificate, string sslCipherList, long sslVersion) 30 | { 31 | } 32 | 33 | string& MockHttp::getRequestBody() 34 | { 35 | return m_requestBody; 36 | } 37 | 38 | string& MockHttp::getResponseBody() 39 | { 40 | return m_responseBody; 41 | } 42 | 43 | string& MockHttp::getResponseCode() 44 | { 45 | return m_responseCode; 46 | } 47 | 48 | string& MockHttp::getResponseMessage() 49 | { 50 | return m_responseMessage; 51 | } 52 | 53 | time_t MockHttp::getResponseTime() 54 | { 55 | return 0; 56 | } 57 | 58 | string& MockHttp::getServerDate() 59 | { 60 | return m_serverDate; 61 | } 62 | 63 | void MockHttp::setRequestBody(string requestBody) 64 | { 65 | m_requestBody = requestBody; 66 | } 67 | 68 | void MockHttp::setResponseBody(string responseBody) 69 | { 70 | m_responseBody = responseBody; 71 | } 72 | 73 | void MockHttp::setResponseCode(string responseCode) 74 | { 75 | m_responseCode = responseCode; 76 | } 77 | 78 | void MockHttp::setResponseMessage(string responseMessage) 79 | { 80 | m_responseMessage = responseMessage; 81 | } 82 | 83 | void MockHttp::setServerDate(string serverDate) 84 | { 85 | m_serverDate = serverDate; 86 | } 87 | -------------------------------------------------------------------------------- /oadrtest/oadrtest/tests/ven/MockHttp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MockHttp.h 3 | * 4 | * Created on: May 17, 2016 5 | * Author: dupes 6 | */ 7 | 8 | #ifndef OADRTEST_OADRTEST_TESTS_VEN_MOCKHTTP_H_ 9 | #define OADRTEST_OADRTEST_TESTS_VEN_MOCKHTTP_H_ 10 | 11 | #include 12 | 13 | class MockHttp : public IHttp 14 | { 15 | private: 16 | string m_requestBody; 17 | string m_responseBody; 18 | string m_responseCode; 19 | string m_responseMessage; 20 | string m_serverDate; 21 | 22 | public: 23 | MockHttp(); 24 | virtual ~MockHttp(); 25 | 26 | bool post(string url, string content) override; 27 | 28 | void setParameters(string clientCertificatePath, string clientPrivateKeyPath, string certificateAuthorityBundlePath, bool verifyCertificate, string sslCipherList, long sslVersion) override; 29 | 30 | string &getRequestBody() override; 31 | string &getResponseBody() override; 32 | 33 | string &getResponseCode() override; 34 | string &getResponseMessage() override; 35 | 36 | time_t getResponseTime() override; 37 | string &getServerDate() override; 38 | 39 | void setRequestBody(string requestBody); 40 | void setResponseBody(string responseBody); 41 | void setResponseCode(string responseCode); 42 | void setResponseMessage(string responseMessage); 43 | void setServerDate(string serverDate); 44 | }; 45 | 46 | #endif /* OADRTEST_OADRTEST_TESTS_VEN_MOCKHTTP_H_ */ 47 | -------------------------------------------------------------------------------- /samplevenmanager/samplevenmanager/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "VENImpl.h" 5 | 6 | #include "easylogging++.h" 7 | 8 | #include 9 | #include 10 | 11 | shared_ptr venManager; 12 | 13 | string vtnURL; 14 | string venName; 15 | 16 | VENManagerConfig config; 17 | 18 | bool logToStdout = true; 19 | 20 | using namespace samplevenmanager; 21 | using namespace std; 22 | 23 | INITIALIZE_EASYLOGGINGPP 24 | 25 | /********************************************************************************/ 26 | 27 | void signalHandler (int signum) 28 | { 29 | venManager->stop(); 30 | } 31 | 32 | /********************************************************************************/ 33 | void printUsage() 34 | { 35 | cout << "Usage: " << endl; 36 | cout << " ./samplevenmgr true" << endl; 37 | } 38 | 39 | /********************************************************************************/ 40 | 41 | bool parseParams(int argc, char **argv) 42 | { 43 | if (argc < 3) 44 | return false; 45 | 46 | config.vtnURL = argv[1]; 47 | config.venName = argv[2]; 48 | 49 | if (argc == 4 && strcmp(argv[3], "false") == 0) 50 | logToStdout = false; 51 | 52 | return true; 53 | } 54 | 55 | /********************************************************************************/ 56 | 57 | int main(int argc, char **argv) 58 | { 59 | if (!parseParams(argc, argv)) 60 | { 61 | printUsage(); 62 | return 0; 63 | } 64 | 65 | shared_ptr venImpl(new VENImpl(config.venName, logToStdout)); 66 | 67 | config.services.eventService = venImpl.get(); 68 | config.services.oadrMessage = venImpl.get(); 69 | config.services.reportService = venImpl.get(); 70 | config.services.exceptionService = venImpl.get(); 71 | 72 | venManager = shared_ptr(VENManager::init(config)); 73 | 74 | signal(SIGINT, signalHandler); 75 | 76 | venManager->run(); 77 | 78 | return 0; 79 | } 80 | -------------------------------------------------------------------------------- /xsd-4.0.0/LICENSE: -------------------------------------------------------------------------------- 1 | This program is free software; you can redistribute it and/or modify 2 | it under the terms of the GNU General Public License version 2 as 3 | published by the Free Software Foundation. 4 | 5 | This program is distributed in the hope that it will be useful, 6 | but WITHOUT ANY WARRANTY; without even the implied warranty of 7 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 8 | GNU General Public License for details. 9 | 10 | You should have received a copy of the GNU General Public License 11 | along with this program; if not, write to the Free Software 12 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 13 | 14 | In addition, as a special exception, Code Synthesis Tools CC gives 15 | permission to link this program with the Xerces-C++ library (or with 16 | modified versions of Xerces-C++ that use the same license as Xerces-C++), 17 | and distribute linked combinations including the two. You must obey 18 | the GNU General Public License version 2 in all respects for all of 19 | the code used other than Xerces-C++. If you modify this copy of the 20 | program, you may extend this exception to your version of the program, 21 | but you are not obligated to do so. If you do not wish to do so, delete 22 | this exception statement from your version. 23 | 24 | In addition, Code Synthesis Tools CC makes a special exception for 25 | the Free/Libre and Open Source Software (FLOSS) which is described 26 | in the accompanying FLOSSE file. 27 | -------------------------------------------------------------------------------- /xsd-4.0.0/README: -------------------------------------------------------------------------------- 1 | libxsd is a runtime library for language mappings generated by 2 | CodeSynthesis XSD, a W3C XML Schema to C++ data binding compiler. 3 | 4 | See the LICENSE file for distribution conditions. 5 | 6 | See the INSTALL file for prerequisites and installation instructions. 7 | 8 | The project page is at http://www.codesynthesis.com/projects/xsd/ 9 | 10 | Send bug reports or any other feedback to the xsd-users@codesynthesis.com 11 | mailing list. 12 | 13 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/compilers/vc-8/post.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/compilers/vc-8/post.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #pragma warning (pop) 6 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/compilers/vc-8/pre.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/compilers/vc-8/pre.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | // These warnings had to be disabled "for good". 6 | // 7 | #pragma warning (disable:4250) // inherits via dominance 8 | #pragma warning (disable:4661) // no definition for explicit instantiation 9 | 10 | 11 | // Push warning state. 12 | // 13 | #pragma warning (push, 3) 14 | 15 | 16 | // Disabled warnings. 17 | // 18 | #pragma warning (disable:4355) // passing 'this' to a member 19 | #pragma warning (disable:4800) // forcing value to bool 20 | #pragma warning (disable:4275) // non dll-interface base 21 | #pragma warning (disable:4251) // base needs to have dll-interface 22 | #pragma warning (disable:4224) // nonstandard extension (/Za option) 23 | 24 | 25 | // Elevated warnings. 26 | // 27 | #pragma warning (2:4239) // standard doesn't allow this conversion 28 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/config.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/config.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_CONFIG_HXX 6 | #define XSD_CXX_CONFIG_HXX 7 | 8 | #include 9 | 10 | // Available C++11 features. 11 | // 12 | #ifdef XSD_CXX11 13 | #ifdef _MSC_VER 14 | # if _MSC_VER >= 1600 15 | # define XSD_CXX11_NULLPTR 16 | # if _MSC_VER >= 1800 17 | # define XSD_CXX11_TEMPLATE_ALIAS 18 | # endif 19 | # endif 20 | #else 21 | # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L 22 | # ifdef __GNUC__ 23 | # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4 24 | # define XSD_CXX11_NULLPTR 25 | # endif 26 | # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || __GNUC__ > 4 27 | # define XSD_CXX11_TEMPLATE_ALIAS 28 | # endif 29 | # else 30 | # define XSD_CXX11_NULLPTR 31 | # define XSD_CXX11_TEMPLATE_ALIAS 32 | # endif 33 | # endif 34 | #endif 35 | #endif // XSD_CXX11 36 | 37 | #ifdef XSD_CXX11 38 | # define XSD_AUTO_PTR std::unique_ptr 39 | #else 40 | # define XSD_AUTO_PTR std::auto_ptr 41 | #endif 42 | 43 | // Macro to suppress the unused variable warning. 44 | // 45 | #define XSD_UNUSED(x) (void)x 46 | 47 | #endif // XSD_CXX_CONFIG_HXX 48 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/exceptions.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/exceptions.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_EXCEPTIONS_HXX 6 | #define XSD_CXX_EXCEPTIONS_HXX 7 | 8 | #include // std::exception 9 | 10 | namespace xsd 11 | { 12 | namespace cxx 13 | { 14 | struct exception: std::exception 15 | { 16 | }; 17 | } 18 | } 19 | 20 | #endif // XSD_CXX_EXCEPTIONS_HXX 21 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/parser/elements.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/parser/elements.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | namespace xsd 6 | { 7 | namespace cxx 8 | { 9 | namespace parser 10 | { 11 | // parser_base 12 | // 13 | template 14 | parser_base:: 15 | ~parser_base () 16 | { 17 | } 18 | 19 | template 20 | void parser_base:: 21 | pre () 22 | { 23 | } 24 | 25 | template 26 | void parser_base:: 27 | _pre () 28 | { 29 | } 30 | 31 | template 32 | void parser_base:: 33 | _post () 34 | { 35 | } 36 | 37 | template 38 | void parser_base:: 39 | _pre_impl () 40 | { 41 | _pre (); 42 | } 43 | 44 | template 45 | void parser_base:: 46 | _post_impl () 47 | { 48 | _post (); 49 | } 50 | 51 | template 52 | const C* parser_base:: 53 | _dynamic_type () const 54 | { 55 | return 0; 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/parser/error-handler.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/parser/error-handler.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_PARSER_ERROR_HANDLER_HXX 6 | #define XSD_CXX_PARSER_ERROR_HANDLER_HXX 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace xsd 13 | { 14 | namespace cxx 15 | { 16 | namespace parser 17 | { 18 | template 19 | class error_handler: public xml::error_handler 20 | { 21 | public: 22 | typedef typename xml::error_handler::severity severity; 23 | 24 | error_handler () 25 | : failed_ (false) 26 | { 27 | } 28 | 29 | virtual bool 30 | handle (const std::basic_string& id, 31 | unsigned long line, 32 | unsigned long column, 33 | severity s, 34 | const std::basic_string& message); 35 | 36 | void 37 | throw_if_failed () const; 38 | 39 | void 40 | reset () 41 | { 42 | failed_ = false; 43 | diagnostics_.clear (); 44 | } 45 | 46 | private: 47 | bool failed_; 48 | diagnostics diagnostics_; 49 | }; 50 | } 51 | } 52 | } 53 | 54 | #include 55 | 56 | #endif // XSD_CXX_PARSER_ERROR_HANDLER_HXX 57 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/parser/error-handler.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/parser/error-handler.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | namespace xsd 6 | { 7 | namespace cxx 8 | { 9 | namespace parser 10 | { 11 | template 12 | bool error_handler:: 13 | handle (const std::basic_string& id, 14 | unsigned long line, 15 | unsigned long column, 16 | severity s, 17 | const std::basic_string& message) 18 | { 19 | diagnostics_.push_back ( 20 | error (s == severity::warning 21 | ? cxx::parser::severity::warning 22 | : cxx::parser::severity::error, 23 | id, line, column, message)); 24 | 25 | if (!failed_ && s != severity::warning) 26 | failed_ = true; 27 | 28 | return true; 29 | } 30 | 31 | template 32 | void error_handler:: 33 | throw_if_failed () const 34 | { 35 | if (failed_) 36 | throw parsing (diagnostics_); 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/parser/exceptions.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/parser/exceptions.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | namespace xsd 6 | { 7 | namespace cxx 8 | { 9 | namespace parser 10 | { 11 | // error 12 | // 13 | template 14 | error:: 15 | error (cxx::parser::severity s, 16 | const std::basic_string& id, 17 | unsigned long line, 18 | unsigned long column, 19 | const std::basic_string& message) 20 | : severity_ (s), 21 | id_ (id), 22 | line_ (line), 23 | column_ (column), 24 | message_ (message) 25 | { 26 | } 27 | 28 | 29 | // parsing 30 | // 31 | template 32 | parsing:: 33 | ~parsing () throw () 34 | { 35 | } 36 | 37 | template 38 | parsing:: 39 | parsing () 40 | { 41 | } 42 | 43 | template 44 | parsing:: 45 | parsing (const cxx::parser::diagnostics& diagnostics) 46 | : diagnostics_ (diagnostics) 47 | { 48 | } 49 | 50 | template 51 | const char* parsing:: 52 | what () const throw () 53 | { 54 | return "instance document parsing failed"; 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/parser/map.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/parser/map.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_PARSER_MAP_HXX 6 | #define XSD_CXX_PARSER_MAP_HXX 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | namespace xsd 15 | { 16 | namespace cxx 17 | { 18 | namespace parser 19 | { 20 | // Parser map. Used in the polymorphic document parsing. 21 | // 22 | template 23 | struct parser_map 24 | { 25 | virtual 26 | ~parser_map (); 27 | 28 | // The type argument is the type name and namespace from the 29 | // xsi:type attribute or substitution group map in the form 30 | // " " with the space and namespace part 31 | // absent if the type does not have a namespace. 32 | // 33 | virtual parser_base* 34 | find (const ro_string& type) const = 0; 35 | }; 36 | 37 | 38 | // Parser map implementation. 39 | // 40 | template 41 | struct parser_map_impl: parser_map 42 | { 43 | parser_map_impl (); 44 | 45 | void 46 | insert (parser_base&); 47 | 48 | virtual parser_base* 49 | find (const ro_string& type) const; 50 | 51 | private: 52 | parser_map_impl (const parser_map_impl&); 53 | 54 | parser_map_impl& 55 | operator= (const parser_map_impl&); 56 | 57 | private: 58 | struct string_comparison 59 | { 60 | bool 61 | operator() (const C* x, const C* y) const 62 | { 63 | ro_string s (x); 64 | return s.compare (y) < 0; 65 | } 66 | }; 67 | 68 | typedef std::map*, string_comparison> map; 69 | map map_; 70 | }; 71 | } 72 | } 73 | } 74 | 75 | #include 76 | #include 77 | 78 | #endif // XSD_CXX_PARSER_MAP_HXX 79 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/parser/map.ixx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/parser/map.ixx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | namespace xsd 6 | { 7 | namespace cxx 8 | { 9 | namespace parser 10 | { 11 | // parser_map_impl 12 | // 13 | template 14 | inline parser_map_impl::parser_map_impl () 15 | { 16 | } 17 | 18 | template 19 | inline void parser_map_impl:: 20 | insert (parser_base& parser) 21 | { 22 | map_[parser._dynamic_type ()] = &parser; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/parser/map.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/parser/map.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | namespace xsd 6 | { 7 | namespace cxx 8 | { 9 | namespace parser 10 | { 11 | // parser_map 12 | // 13 | template 14 | parser_map:: 15 | ~parser_map () 16 | { 17 | } 18 | 19 | // parser_map_impl 20 | // 21 | template 22 | parser_base* parser_map_impl:: 23 | find (const ro_string& type) const 24 | { 25 | typename map::const_iterator i (map_.find (type.data ())); 26 | return i != map_.end () ? i->second : 0; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/parser/non-validating/xml-schema-pskel.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/parser/non-validating/xml-schema-pskel.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | namespace xsd 6 | { 7 | namespace cxx 8 | { 9 | namespace parser 10 | { 11 | namespace non_validating 12 | { 13 | // any_type 14 | // 15 | 16 | template 17 | bool any_type_pskel:: 18 | _start_element_impl (const ro_string& ns, 19 | const ro_string& name, 20 | const ro_string* type) 21 | { 22 | this->_start_any_element (ns, name, type); 23 | this->complex_content::context_.top ().any_ = true; 24 | return true; 25 | } 26 | 27 | template 28 | bool any_type_pskel:: 29 | _end_element_impl (const ro_string& ns, const ro_string& name) 30 | { 31 | this->complex_content::context_.top ().any_ = false; 32 | this->_end_any_element (ns, name); 33 | return true; 34 | } 35 | 36 | 37 | template 38 | bool any_type_pskel:: 39 | _attribute_impl (const ro_string& ns, 40 | const ro_string& name, 41 | const ro_string& value) 42 | { 43 | this->_any_attribute (ns, name, value); 44 | return true; 45 | } 46 | 47 | template 48 | bool any_type_pskel:: 49 | _characters_impl (const ro_string& s) 50 | { 51 | this->_any_characters (s); 52 | return true; 53 | } 54 | 55 | // any_simple_type 56 | // 57 | 58 | template 59 | bool any_simple_type_pskel:: 60 | _characters_impl (const ro_string& s) 61 | { 62 | this->_any_characters (s); 63 | return true; 64 | } 65 | } 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/parser/validating/inheritance-map.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/parser/validating/inheritance-map.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | namespace xsd 6 | { 7 | namespace cxx 8 | { 9 | namespace parser 10 | { 11 | namespace validating 12 | { 13 | template 14 | bool inheritance_map:: 15 | check (const C* derived, const ro_string& base) const 16 | { 17 | if (base == derived) 18 | return true; 19 | 20 | typename map::const_iterator i (map_.find (derived)); 21 | 22 | if (i != map_.end ()) 23 | { 24 | if (base == i->second) 25 | return true; 26 | else 27 | return check (i->second, base); 28 | } 29 | 30 | return false; 31 | } 32 | 33 | // inheritance_map_init 34 | // 35 | template 36 | inheritance_map_init:: 37 | inheritance_map_init () 38 | { 39 | if (count == 0) 40 | map = new inheritance_map; 41 | 42 | ++count; 43 | } 44 | 45 | template 46 | inheritance_map_init:: 47 | ~inheritance_map_init () 48 | { 49 | if (--count == 0) 50 | delete map; 51 | } 52 | 53 | // inheritance_map_entry 54 | // 55 | template 56 | inheritance_map_entry:: 57 | inheritance_map_entry (const C* derived, const C* base) 58 | : derived_ (derived) 59 | { 60 | inheritance_map_instance ().insert (derived, base); 61 | } 62 | 63 | template 64 | inheritance_map_entry:: 65 | ~inheritance_map_entry () 66 | { 67 | inheritance_map_instance ().erase (derived_); 68 | } 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/parser/validating/xml-schema-pskel.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/parser/validating/xml-schema-pskel.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | namespace xsd 6 | { 7 | namespace cxx 8 | { 9 | namespace parser 10 | { 11 | namespace validating 12 | { 13 | // any_type 14 | // 15 | 16 | template 17 | bool any_type_pskel:: 18 | _start_element_impl (const ro_string& ns, 19 | const ro_string& name, 20 | const ro_string* type) 21 | { 22 | this->_start_any_element (ns, name, type); 23 | this->complex_content::context_.top ().any_ = true; 24 | return true; 25 | } 26 | 27 | template 28 | bool any_type_pskel:: 29 | _end_element_impl (const ro_string& ns, const ro_string& name) 30 | { 31 | this->complex_content::context_.top ().any_ = false; 32 | this->_end_any_element (ns, name); 33 | return true; 34 | } 35 | 36 | 37 | template 38 | bool any_type_pskel:: 39 | _attribute_impl_phase_two (const ro_string& ns, 40 | const ro_string& name, 41 | const ro_string& value) 42 | { 43 | this->_any_attribute (ns, name, value); 44 | return true; 45 | } 46 | 47 | template 48 | bool any_type_pskel:: 49 | _characters_impl (const ro_string& s) 50 | { 51 | this->_any_characters (s); 52 | return true; 53 | } 54 | 55 | // any_simple_type 56 | // 57 | 58 | template 59 | bool any_simple_type_pskel:: 60 | _characters_impl (const ro_string& s) 61 | { 62 | this->_any_characters (s); 63 | return true; 64 | } 65 | } 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/parser/xml-schema.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/parser/xml-schema.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | namespace xsd 6 | { 7 | namespace cxx 8 | { 9 | namespace parser 10 | { 11 | // string_sequence 12 | // 13 | template 14 | bool 15 | operator== (const string_sequence& a, const string_sequence& b) 16 | { 17 | if (a.size () != b.size ()) 18 | return false; 19 | 20 | for (typename string_sequence::const_iterator 21 | ai (a.begin ()), bi (b.begin ()), ae (a.end ()); 22 | ai != ae; ++ai, ++bi) 23 | { 24 | if (*ai != *bi) 25 | return false; 26 | } 27 | 28 | return true; 29 | } 30 | } 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/post.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/post.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifdef _MSC_VER 6 | # if (_MSC_VER >= 1400) 7 | # include 8 | # endif 9 | #endif 10 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/pre.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/pre.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifdef _MSC_VER 6 | # if (_MSC_VER >= 1400) 7 | # include 8 | # else 9 | # error Microsoft Visual C++ 7.1 and earlier are not supported 10 | # endif 11 | #endif 12 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/ace-cdr-stream-common.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/ace-cdr-stream-common.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_ACE_CDR_STREAM_COMMON_HXX 6 | #define XSD_CXX_TREE_ACE_CDR_STREAM_COMMON_HXX 7 | 8 | #include 9 | 10 | namespace xsd 11 | { 12 | namespace cxx 13 | { 14 | namespace tree 15 | { 16 | // Base exception for ACE CDR insertion/extraction exceptions. 17 | // 18 | struct ace_cdr_stream_operation: xsd::cxx::exception 19 | { 20 | }; 21 | } 22 | } 23 | } 24 | 25 | #endif // XSD_CXX_TREE_ACE_CDR_STREAM_COMMON_HXX 26 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/element-map.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/element-map.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | namespace xsd 6 | { 7 | namespace cxx 8 | { 9 | namespace tree 10 | { 11 | // element_map 12 | // 13 | template 14 | void element_map:: 15 | register_parser (const qualified_name& n, parser p) 16 | { 17 | (*map_)[n].parser_ = p; 18 | } 19 | 20 | template 21 | void element_map:: 22 | register_serializer (const qualified_name& n, serializer s) 23 | { 24 | (*map_)[n].serializer_ = s; 25 | } 26 | 27 | // element_map_init 28 | // 29 | template 30 | element_map_init:: 31 | element_map_init () 32 | { 33 | if (element_map::count_ == 0) 34 | element_map::map_ = new typename element_map::map; 35 | 36 | ++element_map::count_; 37 | } 38 | 39 | template 40 | element_map_init:: 41 | ~element_map_init () 42 | { 43 | if (--element_map::count_ == 0) 44 | delete element_map::map_; 45 | } 46 | 47 | // parser_init 48 | // 49 | template 50 | parser_init:: 51 | parser_init (const std::basic_string& name, 52 | const std::basic_string& ns) 53 | { 54 | element_map::register_parser ( 55 | xml::qualified_name (name, ns), &parser_impl); 56 | } 57 | 58 | // serializer_init 59 | // 60 | template 61 | serializer_init:: 62 | serializer_init (const std::basic_string& name, 63 | const std::basic_string& ns) 64 | { 65 | element_map::register_serializer ( 66 | xml::qualified_name (name, ns), &serializer_impl); 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/elements.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/elements.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #include 6 | 7 | namespace xsd 8 | { 9 | namespace cxx 10 | { 11 | namespace tree 12 | { 13 | // user_data_keys_template 14 | // 15 | template 16 | const XMLCh user_data_keys_template::node[21] = 17 | {xercesc::chLatin_x, xercesc::chLatin_s, xercesc::chLatin_d, // xsd 18 | xercesc::chColon, xercesc::chColon, // :: 19 | xercesc::chLatin_c, xercesc::chLatin_x, xercesc::chLatin_x, // cxx 20 | xercesc::chColon, xercesc::chColon, // :: 21 | xercesc::chLatin_t, xercesc::chLatin_r, xercesc::chLatin_e, // tre 22 | xercesc::chLatin_e, xercesc::chColon, xercesc::chColon, // e:: 23 | xercesc::chLatin_n, xercesc::chLatin_o, xercesc::chLatin_d, // nod 24 | xercesc::chLatin_e, xercesc::chNull // e\0 25 | }; 26 | 27 | 28 | // simple_type 29 | // 30 | template 31 | simple_type:: 32 | simple_type (const simple_type& other, 33 | flags f, 34 | container* c) 35 | : B (other, f, c) 36 | { 37 | } 38 | 39 | template 40 | simple_type* simple_type:: 41 | _clone (flags f, container* c) const 42 | { 43 | return new simple_type (*this, f, c); 44 | } 45 | 46 | // fundamental_base 47 | // 48 | template 49 | fundamental_base* fundamental_base:: 50 | _clone (flags f, container* c) const 51 | { 52 | return new fundamental_base (*this, f, c); 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/error-handler.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/error-handler.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_ERROR_HANDLER_HXX 6 | #define XSD_CXX_TREE_ERROR_HANDLER_HXX 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace xsd 13 | { 14 | namespace cxx 15 | { 16 | namespace tree 17 | { 18 | template 19 | class error_handler: public xml::error_handler 20 | { 21 | public: 22 | typedef typename xml::error_handler::severity severity; 23 | 24 | error_handler () 25 | : failed_ (false) 26 | { 27 | } 28 | 29 | virtual bool 30 | handle (const std::basic_string& id, 31 | unsigned long line, 32 | unsigned long column, 33 | severity, 34 | const std::basic_string& message); 35 | 36 | template 37 | void 38 | throw_if_failed () const 39 | { 40 | if (failed_) 41 | throw E (diagnostics_); 42 | } 43 | 44 | void 45 | reset () 46 | { 47 | failed_ = false; 48 | diagnostics_.clear (); 49 | } 50 | 51 | private: 52 | bool failed_; 53 | diagnostics diagnostics_; 54 | }; 55 | } 56 | } 57 | } 58 | 59 | #include 60 | 61 | #endif // XSD_CXX_TREE_ERROR_HANDLER_HXX 62 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/error-handler.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/error-handler.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | namespace xsd 6 | { 7 | namespace cxx 8 | { 9 | namespace tree 10 | { 11 | template 12 | bool error_handler:: 13 | handle (const std::basic_string& id, 14 | unsigned long line, 15 | unsigned long column, 16 | severity s, 17 | const std::basic_string& message) 18 | { 19 | diagnostics_.push_back ( 20 | error (s == severity::warning 21 | ? tree::severity::warning 22 | : tree::severity::error, id, line, column, message)); 23 | 24 | if (!failed_ && s != severity::warning) 25 | failed_ = true; 26 | 27 | return true; 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/facet.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/facet.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_FACET_HXX 6 | #define XSD_CXX_TREE_FACET_HXX 7 | 8 | namespace xsd 9 | { 10 | namespace cxx 11 | { 12 | namespace tree 13 | { 14 | // We need to keep this type POD in order to be able to create a 15 | // static array. 16 | // 17 | struct facet 18 | { 19 | enum id_type 20 | { 21 | none, 22 | total_digits, 23 | fraction_digits 24 | }; 25 | 26 | id_type id; 27 | unsigned long value; 28 | 29 | static const facet* 30 | find (const facet* facets, facet::id_type id) 31 | { 32 | while (facets->id != id && facets->id != none) 33 | ++facets; 34 | 35 | return facets->id != none ? facets : 0; 36 | } 37 | }; 38 | } 39 | } 40 | } 41 | 42 | #endif // XSD_CXX_TREE_FACET_HXX 43 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/istream-fwd.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/istream-fwd.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_ISTREAM_FWD_HXX 6 | #define XSD_CXX_TREE_ISTREAM_FWD_HXX 7 | 8 | namespace xsd 9 | { 10 | namespace cxx 11 | { 12 | namespace tree 13 | { 14 | template 15 | class istream; 16 | } 17 | } 18 | } 19 | 20 | #endif // XSD_CXX_TREE_ISTREAM_FWD_HXX 21 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/parsing.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/parsing.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_PARSING_HXX 6 | #define XSD_CXX_TREE_PARSING_HXX 7 | 8 | #include 9 | #include 10 | 11 | #endif // XSD_CXX_TREE_PARSING_HXX 12 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/parsing/element-map.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/parsing/element-map.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_PARSING_ELEMENT_MAP_TXX 6 | #define XSD_CXX_TREE_PARSING_ELEMENT_MAP_TXX 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace xsd 13 | { 14 | namespace cxx 15 | { 16 | namespace tree 17 | { 18 | template 19 | XSD_AUTO_PTR > element_map:: 20 | parse (const xercesc::DOMElement& e, flags f) 21 | { 22 | const qualified_name n (xml::dom::name (e)); 23 | typename map::const_iterator i (map_->find (n)); 24 | 25 | if (i != map_->end () && i->second.parser_ != 0) 26 | return (i->second.parser_) (e, f); 27 | else 28 | throw no_element_info (n.name (), n.namespace_ ()); 29 | } 30 | 31 | template 32 | XSD_AUTO_PTR > 33 | parser_impl (const xercesc::DOMElement& e, flags f) 34 | { 35 | return XSD_AUTO_PTR > (new T (e, f)); 36 | } 37 | } 38 | } 39 | } 40 | 41 | #endif // XSD_CXX_TREE_PARSING_ELEMENT_MAP_TXX 42 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/serialization.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/serialization.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_SERIALIZATION_HXX 6 | #define XSD_CXX_TREE_SERIALIZATION_HXX 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace xsd 13 | { 14 | namespace cxx 15 | { 16 | namespace tree 17 | { 18 | // 19 | // 20 | template 21 | class list_stream 22 | { 23 | public: 24 | list_stream (std::basic_ostringstream& os, 25 | xercesc::DOMElement& parent) 26 | : os_ (os), parent_ (parent) 27 | { 28 | } 29 | 30 | std::basic_ostringstream& os_; 31 | xercesc::DOMElement& parent_; 32 | }; 33 | 34 | template 35 | class as_double 36 | { 37 | public: 38 | as_double (const T& v) 39 | : x (v) 40 | { 41 | } 42 | 43 | const T& x; 44 | }; 45 | 46 | template 47 | class as_decimal 48 | { 49 | public: 50 | as_decimal (const T& v, const facet* f = 0) 51 | : x (v), facets (f) 52 | { 53 | } 54 | 55 | const T& x; 56 | const facet* facets; 57 | }; 58 | } 59 | } 60 | } 61 | 62 | #include 63 | #include 64 | 65 | #endif // XSD_CXX_TREE_SERIALIZATION_HXX 66 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/serialization/boolean.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/serialization/boolean.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_SERIALIZATION_BOOLEAN_HXX 6 | #define XSD_CXX_TREE_SERIALIZATION_BOOLEAN_HXX 7 | 8 | #include 9 | 10 | namespace XERCES_CPP_NAMESPACE 11 | { 12 | inline void 13 | operator<< (xercesc::DOMElement& e, bool b) 14 | { 15 | std::basic_ostringstream os; 16 | os.setf (std::ios_base::boolalpha); 17 | os << b; 18 | e << os.str (); 19 | } 20 | 21 | inline void 22 | operator<< (xercesc::DOMAttr& a, bool b) 23 | { 24 | std::basic_ostringstream os; 25 | os.setf (std::ios_base::boolalpha); 26 | os << b; 27 | a << os.str (); 28 | } 29 | } 30 | 31 | namespace xsd 32 | { 33 | namespace cxx 34 | { 35 | namespace tree 36 | { 37 | template 38 | inline void 39 | operator<< (list_stream& ls, bool b) 40 | { 41 | // We don't need to restore the original bool format flag 42 | // since items in the list are all of the same type. 43 | // 44 | ls.os_.setf (std::ios_base::boolalpha); 45 | ls.os_ << b; 46 | } 47 | } 48 | } 49 | } 50 | 51 | #endif // XSD_CXX_TREE_SERIALIZATION_BOOLEAN_HXX 52 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/serialization/byte.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/serialization/byte.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_SERIALIZATION_BYTE_HXX 6 | #define XSD_CXX_TREE_SERIALIZATION_BYTE_HXX 7 | 8 | #include 9 | 10 | namespace XERCES_CPP_NAMESPACE 11 | { 12 | inline void 13 | operator<< (xercesc::DOMElement& e, signed char c) 14 | { 15 | std::basic_ostringstream os; 16 | os << static_cast (c); 17 | e << os.str (); 18 | } 19 | 20 | inline void 21 | operator<< (xercesc::DOMAttr& a, signed char c) 22 | { 23 | std::basic_ostringstream os; 24 | os << static_cast (c); 25 | a << os.str (); 26 | } 27 | } 28 | 29 | namespace xsd 30 | { 31 | namespace cxx 32 | { 33 | namespace tree 34 | { 35 | template 36 | inline void 37 | operator<< (list_stream& ls, signed char c) 38 | { 39 | ls.os_ << static_cast (c); 40 | } 41 | } 42 | } 43 | } 44 | 45 | #endif // XSD_CXX_TREE_SERIALIZATION_BYTE_HXX 46 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/serialization/element-map.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/serialization/element-map.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_SERIALIZATION_ELEMENT_MAP_TXX 6 | #define XSD_CXX_TREE_SERIALIZATION_ELEMENT_MAP_TXX 7 | 8 | #include 9 | 10 | namespace xsd 11 | { 12 | namespace cxx 13 | { 14 | namespace tree 15 | { 16 | template 17 | void element_map:: 18 | serialize (xercesc::DOMElement& e, const element_type& x) 19 | { 20 | const qualified_name n (x._name (), x._namespace ()); 21 | typename map::const_iterator i (map_->find (n)); 22 | 23 | if (i != map_->end () && i->second.serializer_ != 0) 24 | return (i->second.serializer_) (e, x); 25 | else 26 | throw no_element_info (n.name (), n.namespace_ ()); 27 | } 28 | 29 | template 30 | void 31 | serializer_impl (xercesc::DOMElement& e, const element_type& x) 32 | { 33 | e << static_cast (x); 34 | } 35 | } 36 | } 37 | } 38 | 39 | #endif // XSD_CXX_TREE_SERIALIZATION_ELEMENT_MAP_TXX 40 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/serialization/int.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/serialization/int.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_SERIALIZATION_INT_HXX 6 | #define XSD_CXX_TREE_SERIALIZATION_INT_HXX 7 | 8 | #include 9 | 10 | namespace XERCES_CPP_NAMESPACE 11 | { 12 | inline void 13 | operator<< (xercesc::DOMElement& e, int i) 14 | { 15 | std::basic_ostringstream os; 16 | os << i; 17 | e << os.str (); 18 | } 19 | 20 | inline void 21 | operator<< (xercesc::DOMAttr& a, int i) 22 | { 23 | std::basic_ostringstream os; 24 | os << i; 25 | a << os.str (); 26 | } 27 | } 28 | 29 | namespace xsd 30 | { 31 | namespace cxx 32 | { 33 | namespace tree 34 | { 35 | template 36 | inline void 37 | operator<< (list_stream& ls, int i) 38 | { 39 | ls.os_ << i; 40 | } 41 | } 42 | } 43 | } 44 | 45 | #endif // XSD_CXX_TREE_SERIALIZATION_INT_HXX 46 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/serialization/long.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/serialization/long.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_SERIALIZATION_LONG_HXX 6 | #define XSD_CXX_TREE_SERIALIZATION_LONG_HXX 7 | 8 | #include 9 | 10 | namespace XERCES_CPP_NAMESPACE 11 | { 12 | inline void 13 | operator<< (xercesc::DOMElement& e, long long l) 14 | { 15 | std::basic_ostringstream os; 16 | os << l; 17 | e << os.str (); 18 | } 19 | 20 | inline void 21 | operator<< (xercesc::DOMAttr& a, long long l) 22 | { 23 | std::basic_ostringstream os; 24 | os << l; 25 | a << os.str (); 26 | } 27 | } 28 | 29 | namespace xsd 30 | { 31 | namespace cxx 32 | { 33 | namespace tree 34 | { 35 | template 36 | inline void 37 | operator<< (list_stream& ls, long long l) 38 | { 39 | ls.os_ << l; 40 | } 41 | } 42 | } 43 | } 44 | 45 | #endif // XSD_CXX_TREE_SERIALIZATION_LONG_HXX 46 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/serialization/short.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/serialization/short.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_SERIALIZATION_SHORT_HXX 6 | #define XSD_CXX_TREE_SERIALIZATION_SHORT_HXX 7 | 8 | #include 9 | 10 | namespace XERCES_CPP_NAMESPACE 11 | { 12 | inline void 13 | operator<< (xercesc::DOMElement& e, short s) 14 | { 15 | std::basic_ostringstream os; 16 | os << s; 17 | e << os.str (); 18 | } 19 | 20 | inline void 21 | operator<< (xercesc::DOMAttr& a, short s) 22 | { 23 | std::basic_ostringstream os; 24 | os << s; 25 | a << os.str (); 26 | } 27 | } 28 | 29 | namespace xsd 30 | { 31 | namespace cxx 32 | { 33 | namespace tree 34 | { 35 | template 36 | inline void 37 | operator<< (list_stream& ls, short s) 38 | { 39 | ls.os_ << s; 40 | } 41 | } 42 | } 43 | } 44 | 45 | #endif // XSD_CXX_TREE_SERIALIZATION_SHORT_HXX 46 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/serialization/unsigned-byte.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/serialization/unsigned-byte.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_SERIALIZATION_UNSIGNED_BYTE_HXX 6 | #define XSD_CXX_TREE_SERIALIZATION_UNSIGNED_BYTE_HXX 7 | 8 | #include 9 | 10 | namespace XERCES_CPP_NAMESPACE 11 | { 12 | inline void 13 | operator<< (xercesc::DOMElement& e, unsigned char c) 14 | { 15 | std::basic_ostringstream os; 16 | os << static_cast (c); 17 | e << os.str (); 18 | } 19 | 20 | inline void 21 | operator<< (xercesc::DOMAttr& a, unsigned char c) 22 | { 23 | std::basic_ostringstream os; 24 | os << static_cast (c); 25 | a << os.str (); 26 | } 27 | } 28 | 29 | namespace xsd 30 | { 31 | namespace cxx 32 | { 33 | namespace tree 34 | { 35 | template 36 | inline void 37 | operator<< (list_stream& ls, unsigned char c) 38 | { 39 | ls.os_ << static_cast (c); 40 | } 41 | } 42 | } 43 | } 44 | 45 | #endif // XSD_CXX_TREE_SERIALIZATION_UNSIGNED_BYTE_HXX 46 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/serialization/unsigned-int.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/serialization/unsigned-int.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_SERIALIZATION_UNSIGNED_INT_HXX 6 | #define XSD_CXX_TREE_SERIALIZATION_UNSIGNED_INT_HXX 7 | 8 | #include 9 | 10 | namespace XERCES_CPP_NAMESPACE 11 | { 12 | inline void 13 | operator<< (xercesc::DOMElement& e, unsigned int i) 14 | { 15 | std::basic_ostringstream os; 16 | os << i; 17 | e << os.str (); 18 | } 19 | 20 | inline void 21 | operator<< (xercesc::DOMAttr& a, unsigned int i) 22 | { 23 | std::basic_ostringstream os; 24 | os << i; 25 | a << os.str (); 26 | } 27 | } 28 | 29 | namespace xsd 30 | { 31 | namespace cxx 32 | { 33 | namespace tree 34 | { 35 | template 36 | inline void 37 | operator<< (list_stream& ls, unsigned int i) 38 | { 39 | ls.os_ << i; 40 | } 41 | } 42 | } 43 | } 44 | 45 | #endif // XSD_CXX_TREE_SERIALIZATION_UNSIGNED_INT_HXX 46 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/serialization/unsigned-long.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/serialization/unsigned-long.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_SERIALIZATION_UNSIGNED_LONG_HXX 6 | #define XSD_CXX_TREE_SERIALIZATION_UNSIGNED_LONG_HXX 7 | 8 | #include 9 | 10 | namespace XERCES_CPP_NAMESPACE 11 | { 12 | inline void 13 | operator<< (xercesc::DOMElement& e, unsigned long long l) 14 | { 15 | std::basic_ostringstream os; 16 | os << l; 17 | e << os.str (); 18 | } 19 | 20 | inline void 21 | operator<< (xercesc::DOMAttr& a, unsigned long long l) 22 | { 23 | std::basic_ostringstream os; 24 | os << l; 25 | a << os.str (); 26 | } 27 | } 28 | 29 | namespace xsd 30 | { 31 | namespace cxx 32 | { 33 | namespace tree 34 | { 35 | template 36 | inline void 37 | operator<< (list_stream& ls, unsigned long long l) 38 | { 39 | ls.os_ << l; 40 | } 41 | } 42 | } 43 | } 44 | 45 | #endif // XSD_CXX_TREE_SERIALIZATION_UNSIGNED_LONG_HXX 46 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/serialization/unsigned-short.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/serialization/unsigned-short.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_SERIALIZATION_UNSIGNED_SHORT_HXX 6 | #define XSD_CXX_TREE_SERIALIZATION_UNSIGNED_SHORT_HXX 7 | 8 | #include 9 | 10 | namespace XERCES_CPP_NAMESPACE 11 | { 12 | inline void 13 | operator<< (xercesc::DOMElement& e, unsigned short s) 14 | { 15 | std::basic_ostringstream os; 16 | os << s; 17 | e << os.str (); 18 | } 19 | 20 | inline void 21 | operator<< (xercesc::DOMAttr& a, unsigned short s) 22 | { 23 | std::basic_ostringstream os; 24 | os << s; 25 | a << os.str (); 26 | } 27 | } 28 | 29 | namespace xsd 30 | { 31 | namespace cxx 32 | { 33 | namespace tree 34 | { 35 | template 36 | inline void 37 | operator<< (list_stream& ls, unsigned short s) 38 | { 39 | ls.os_ << s; 40 | } 41 | } 42 | } 43 | } 44 | 45 | #endif // XSD_CXX_TREE_SERIALIZATION_UNSIGNED_SHORT_HXX 46 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/text.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/text.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_TEXT_HXX 6 | #define XSD_CXX_TREE_TEXT_HXX 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace xsd 13 | { 14 | namespace cxx 15 | { 16 | namespace tree 17 | { 18 | // Throws expected_text_content. 19 | // 20 | template 21 | std::basic_string 22 | text_content (const xercesc::DOMElement&); 23 | } 24 | } 25 | } 26 | 27 | #include 28 | 29 | #endif // XSD_CXX_TREE_TEXT_HXX 30 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/text.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/text.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #include 6 | 7 | #include 8 | 9 | #include 10 | 11 | namespace xsd 12 | { 13 | namespace cxx 14 | { 15 | namespace tree 16 | { 17 | template 18 | std::basic_string 19 | text_content (const xercesc::DOMElement& e) 20 | { 21 | using xercesc::DOMNode; 22 | using xercesc::DOMText; 23 | 24 | DOMNode* n (e.getFirstChild ()); 25 | 26 | // Fast path. 27 | // 28 | if (n != 0 && 29 | n->getNodeType () == DOMNode::TEXT_NODE && 30 | n->getNextSibling () == 0) 31 | { 32 | DOMText* t (static_cast (n)); 33 | return xml::transcode (t->getData (), t->getLength ()); 34 | } 35 | 36 | std::basic_string r; 37 | 38 | for (; n != 0; n = n->getNextSibling ()) 39 | { 40 | switch (n->getNodeType ()) 41 | { 42 | case DOMNode::TEXT_NODE: 43 | case DOMNode::CDATA_SECTION_NODE: 44 | { 45 | DOMText* t (static_cast (n)); 46 | r += xml::transcode (t->getData (), t->getLength ()); 47 | break; 48 | } 49 | case DOMNode::ELEMENT_NODE: 50 | { 51 | throw expected_text_content (); 52 | } 53 | default: 54 | break; // ignore 55 | } 56 | } 57 | 58 | return r; 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/tree/xdr-stream-common.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/tree/xdr-stream-common.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_TREE_XDR_STREAM_COMMON_HXX 6 | #define XSD_CXX_TREE_XDR_STREAM_COMMON_HXX 7 | 8 | #include 9 | 10 | namespace xsd 11 | { 12 | namespace cxx 13 | { 14 | namespace tree 15 | { 16 | // Base exception for XDR insertion/extraction exceptions. 17 | // 18 | struct xdr_stream_operation: xsd::cxx::exception 19 | { 20 | }; 21 | } 22 | } 23 | } 24 | 25 | #endif // XSD_CXX_TREE_XDR_STREAM_COMMON_HXX 26 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/version.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/version.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_VERSION_HXX 6 | #define XSD_CXX_VERSION_HXX 7 | 8 | // Version format is AABBCCDD where 9 | // 10 | // AA - major version number 11 | // BB - minor version number 12 | // CC - bugfix version number 13 | // DD - alpha / beta (DD + 50) version number 14 | // 15 | // When DD is not 00, 1 is subtracted from AABBCC. For example: 16 | // 17 | // Version AABBCCDD 18 | // 2.0.0 02000000 19 | // 2.1.0 02010000 20 | // 2.1.1 02010100 21 | // 2.2.0.a1 02019901 22 | // 3.0.0.b2 02999952 23 | // 24 | 25 | #define XSD_STR_VERSION "4.0.0" 26 | #define XSD_INT_VERSION 4000000L 27 | 28 | #endif // XSD_CXX_VERSION_HXX 29 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/xml/bits/literals.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/xml/bits/literals.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_XML_BITS_LITERALS_HXX 6 | #define XSD_CXX_XML_BITS_LITERALS_HXX 7 | 8 | namespace xsd 9 | { 10 | namespace cxx 11 | { 12 | namespace xml 13 | { 14 | namespace bits 15 | { 16 | template 17 | const C* 18 | xml_prefix (); 19 | 20 | template 21 | const C* 22 | xml_namespace (); 23 | 24 | template 25 | const C* 26 | xmlns_prefix (); 27 | 28 | template 29 | const C* 30 | xmlns_namespace (); 31 | 32 | template 33 | const C* 34 | xsi_prefix (); 35 | 36 | template 37 | const C* 38 | xsi_namespace (); 39 | 40 | template 41 | const C* 42 | type (); 43 | 44 | template 45 | const C* 46 | nil_lit (); 47 | 48 | template 49 | const C* 50 | schema_location (); 51 | 52 | template 53 | const C* 54 | no_namespace_schema_location (); 55 | 56 | template 57 | const C* 58 | first_prefix (); 59 | 60 | template 61 | const C* 62 | second_prefix (); 63 | 64 | template 65 | const C* 66 | third_prefix (); 67 | 68 | template 69 | const C* 70 | fourth_prefix (); 71 | 72 | template 73 | const C* 74 | fifth_prefix (); 75 | } 76 | } 77 | } 78 | } 79 | 80 | #endif // XSD_CXX_XML_BITS_LITERALS_HXX 81 | 82 | #include 83 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/xml/char-iso8859-1.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/xml/char-iso8859-1.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_XML_TRANSCODER 6 | #define XSD_CXX_XML_TRANSCODER 7 | #define XSD_CXX_XML_TRANSCODER_CHAR_ISO8859_1 8 | 9 | #include 10 | #include // std::size_t 11 | 12 | #include // XMLCh 13 | 14 | #include // invalid_utf16_string 15 | 16 | namespace xsd 17 | { 18 | namespace cxx 19 | { 20 | namespace xml 21 | { 22 | struct iso8859_1_unrepresentable {}; 23 | 24 | // UTF-16 to/from ISO-8859-1 transcoder. 25 | // 26 | template 27 | struct char_iso8859_1_transcoder 28 | { 29 | static std::basic_string 30 | to (const XMLCh* s, std::size_t length); 31 | 32 | static XMLCh* 33 | from (const C* s, std::size_t length); 34 | 35 | // Get/set a replacement for unrepresentable characters. If set to 36 | // 0 (the default value), throw iso8859_1_unrepresentable instead. 37 | // 38 | static C 39 | unrep_char () 40 | { 41 | return unrep_char_; 42 | } 43 | 44 | static void 45 | unrep_char (C c) 46 | { 47 | unrep_char_ = c; 48 | } 49 | 50 | private: 51 | static C unrep_char_; 52 | }; 53 | 54 | typedef char_iso8859_1_transcoder char_transcoder; 55 | } 56 | } 57 | } 58 | 59 | #include 60 | 61 | #else 62 | # ifndef XSD_CXX_XML_TRANSCODER_CHAR_ISO8859_1 63 | // 64 | // If you get this error, it usually means that either you compiled 65 | // your schemas with different --char-encoding values or you included 66 | // some of the libxsd headers (e.g., xsd/cxx/xml/string.hxx) directly 67 | // without first including the correct xsd/cxx/xml/char-*.hxx header. 68 | // 69 | # error conflicting character encoding detected 70 | # endif 71 | #endif // XSD_CXX_XML_TRANSCODER 72 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/xml/char-lcp.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/xml/char-lcp.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_XML_TRANSCODER 6 | #define XSD_CXX_XML_TRANSCODER 7 | #define XSD_CXX_XML_TRANSCODER_CHAR_LCP 8 | 9 | #include 10 | #include // std::size_t 11 | 12 | #include // XMLCh 13 | 14 | namespace xsd 15 | { 16 | namespace cxx 17 | { 18 | namespace xml 19 | { 20 | // UTF-16 to/from Xerces-C++ local code page (LCP) transcoder. 21 | // 22 | // Note that this transcoder has a custom interface due to Xerces-C++ 23 | // idiosyncrasies. Don't use it as a base for your custom transcoder. 24 | // 25 | template 26 | struct char_lcp_transcoder 27 | { 28 | static std::basic_string 29 | to (const XMLCh* s); 30 | 31 | static std::basic_string 32 | to (const XMLCh* s, std::size_t length); 33 | 34 | static XMLCh* 35 | from (const C* s); 36 | }; 37 | 38 | typedef char_lcp_transcoder char_transcoder; 39 | } 40 | } 41 | } 42 | 43 | #include 44 | 45 | #else 46 | # ifndef XSD_CXX_XML_TRANSCODER_CHAR_LCP 47 | // 48 | // If you get this error, it usually means that either you compiled 49 | // your schemas with different --char-encoding values or you included 50 | // some of the libxsd headers (e.g., xsd/cxx/xml/string.hxx) directly 51 | // without first including the correct xsd/cxx/xml/char-*.hxx header. 52 | // 53 | # error conflicting character encoding detected 54 | # endif 55 | #endif // XSD_CXX_XML_TRANSCODER 56 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/xml/char-lcp.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/xml/char-lcp.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #include // std::memcpy 6 | 7 | #include 8 | 9 | #include // XSD_CXX11 10 | 11 | #ifdef XSD_CXX11 12 | # include // std::unique_ptr 13 | #else 14 | # include 15 | #endif 16 | 17 | #include 18 | 19 | namespace xsd 20 | { 21 | namespace cxx 22 | { 23 | namespace xml 24 | { 25 | template 26 | std::basic_string char_lcp_transcoder:: 27 | to (const XMLCh* s) 28 | { 29 | std_memory_manager mm; 30 | #ifdef XSD_CXX11 31 | std::unique_ptr r ( 32 | #else 33 | auto_array r ( 34 | #endif 35 | xercesc::XMLString::transcode (s, &mm), mm); 36 | return std::basic_string (r.get ()); 37 | } 38 | 39 | template 40 | std::basic_string char_lcp_transcoder:: 41 | to (const XMLCh* s, std::size_t len) 42 | { 43 | #ifdef XSD_CXX11 44 | std::unique_ptr tmp ( 45 | #else 46 | auto_array tmp ( 47 | #endif 48 | new XMLCh[len + 1]); 49 | std::memcpy (tmp.get (), s, len * sizeof (XMLCh)); 50 | tmp[len] = XMLCh (0); 51 | 52 | std_memory_manager mm; 53 | #ifdef XSD_CXX11 54 | std::unique_ptr r ( 55 | #else 56 | auto_array r ( 57 | #endif 58 | xercesc::XMLString::transcode (tmp.get (), &mm), mm); 59 | 60 | tmp.reset (); 61 | 62 | return std::basic_string (r.get ()); 63 | } 64 | 65 | template 66 | XMLCh* char_lcp_transcoder:: 67 | from (const C* s) 68 | { 69 | std_memory_manager mm; 70 | return xercesc::XMLString::transcode (s, &mm); 71 | } 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/xml/char-utf8.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/xml/char-utf8.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_XML_TRANSCODER 6 | #define XSD_CXX_XML_TRANSCODER 7 | #define XSD_CXX_XML_TRANSCODER_CHAR_UTF8 8 | 9 | #include 10 | #include // std::size_t 11 | 12 | #include // XMLCh 13 | 14 | #include // invalid_utf16_string 15 | 16 | namespace xsd 17 | { 18 | namespace cxx 19 | { 20 | namespace xml 21 | { 22 | struct invalid_utf8_string {}; 23 | 24 | // UTF-16 to/from UTF-8 transcoder. 25 | // 26 | template 27 | struct char_utf8_transcoder 28 | { 29 | static std::basic_string 30 | to (const XMLCh* s, std::size_t length); 31 | 32 | static XMLCh* 33 | from (const C* s, std::size_t length); 34 | 35 | private: 36 | static const unsigned char first_byte_mask_[5]; 37 | }; 38 | 39 | typedef char_utf8_transcoder char_transcoder; 40 | } 41 | } 42 | } 43 | 44 | #include 45 | 46 | #else 47 | # ifndef XSD_CXX_XML_TRANSCODER_CHAR_UTF8 48 | // 49 | // If you get this error, it usually means that either you compiled 50 | // your schemas with different --char-encoding values or you included 51 | // some of the libxsd headers (e.g., xsd/cxx/xml/string.hxx) directly 52 | // without first including the correct xsd/cxx/xml/char-*.hxx header. 53 | // 54 | # error conflicting character encoding detected 55 | # endif 56 | #endif // XSD_CXX_XML_TRANSCODER 57 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/xml/dom/bits/error-handler-proxy.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/xml/dom/bits/error-handler-proxy.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_XML_DOM_BITS_ERROR_HANDLER_PROXY_HXX 6 | #define XSD_CXX_XML_DOM_BITS_ERROR_HANDLER_PROXY_HXX 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | namespace xsd 15 | { 16 | namespace cxx 17 | { 18 | namespace xml 19 | { 20 | namespace dom 21 | { 22 | namespace bits 23 | { 24 | template 25 | class error_handler_proxy: public xercesc::DOMErrorHandler 26 | { 27 | public: 28 | error_handler_proxy (error_handler& eh) 29 | : failed_ (false), eh_ (&eh), native_eh_ (0) 30 | { 31 | } 32 | 33 | error_handler_proxy (xercesc::DOMErrorHandler& eh) 34 | : failed_ (false), eh_ (0), native_eh_ (&eh) 35 | { 36 | } 37 | 38 | virtual bool 39 | handleError (const xercesc::DOMError& e); 40 | 41 | bool 42 | failed () const 43 | { 44 | return failed_; 45 | } 46 | 47 | private: 48 | bool failed_; 49 | error_handler* eh_; 50 | xercesc::DOMErrorHandler* native_eh_; 51 | }; 52 | } 53 | } 54 | } 55 | } 56 | } 57 | 58 | #include 59 | 60 | #endif // XSD_CXX_XML_DOM_BITS_ERROR_HANDLER_PROXY_HXX 61 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/xml/dom/bits/error-handler-proxy.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/xml/dom/bits/error-handler-proxy.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #include 6 | 7 | namespace xsd 8 | { 9 | namespace cxx 10 | { 11 | namespace xml 12 | { 13 | namespace dom 14 | { 15 | namespace bits 16 | { 17 | template 18 | bool error_handler_proxy:: 19 | handleError (const xercesc::DOMError& e) 20 | { 21 | using xercesc::DOMError; 22 | 23 | if (e.getSeverity() != DOMError::DOM_SEVERITY_WARNING) 24 | failed_ = true; 25 | 26 | if (native_eh_) 27 | return native_eh_->handleError (e); 28 | else 29 | { 30 | typedef typename error_handler::severity severity; 31 | 32 | severity s (severity::error); 33 | 34 | switch (e.getSeverity()) 35 | { 36 | case DOMError::DOM_SEVERITY_WARNING: 37 | { 38 | s = severity::warning; 39 | break; 40 | } 41 | case DOMError::DOM_SEVERITY_ERROR: 42 | { 43 | s = severity::error; 44 | break; 45 | } 46 | case DOMError::DOM_SEVERITY_FATAL_ERROR: 47 | { 48 | s = severity::fatal; 49 | break; 50 | } 51 | } 52 | 53 | xercesc::DOMLocator* loc (e.getLocation ()); 54 | 55 | return eh_->handle ( 56 | transcode (loc->getURI ()), 57 | static_cast (loc->getLineNumber ()), 58 | static_cast (loc->getColumnNumber ()), 59 | s, 60 | transcode (e.getMessage ())); 61 | } 62 | } 63 | } 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/xml/dom/elements.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/xml/dom/elements.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_XML_DOM_ELEMENTS_HXX 6 | #define XSD_CXX_XML_DOM_ELEMENTS_HXX 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | namespace xsd 14 | { 15 | namespace cxx 16 | { 17 | namespace xml 18 | { 19 | namespace dom 20 | { 21 | template 22 | qualified_name 23 | name (const xercesc::DOMAttr&); 24 | 25 | template 26 | qualified_name 27 | name (const xercesc::DOMElement&); 28 | } 29 | } 30 | } 31 | } 32 | 33 | #include 34 | 35 | #endif // XSD_CXX_XML_DOM_ELEMENTS_HXX 36 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/xml/dom/elements.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/xml/dom/elements.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #include 6 | 7 | namespace xsd 8 | { 9 | namespace cxx 10 | { 11 | namespace xml 12 | { 13 | namespace dom 14 | { 15 | template 16 | qualified_name 17 | name (const xercesc::DOMAttr& a) 18 | { 19 | const XMLCh* n (a.getLocalName ()); 20 | 21 | // If this DOM doesn't support namespaces then use getName. 22 | // 23 | if (n != 0) 24 | { 25 | if (const XMLCh* ns = a.getNamespaceURI ()) 26 | return qualified_name (transcode (n), transcode (ns)); 27 | else 28 | return qualified_name (transcode (n)); 29 | } 30 | else 31 | return qualified_name (transcode (a.getName ())); 32 | } 33 | 34 | 35 | template 36 | qualified_name 37 | name (const xercesc::DOMElement& e) 38 | { 39 | const XMLCh* n (e.getLocalName ()); 40 | 41 | // If this DOM doesn't support namespaces then use getTagName. 42 | // 43 | if (n != 0) 44 | { 45 | if (const XMLCh* ns = e.getNamespaceURI ()) 46 | return qualified_name (transcode (n), transcode (ns)); 47 | else 48 | return qualified_name (transcode (n)); 49 | } 50 | else 51 | return qualified_name (transcode (e.getTagName ())); 52 | } 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/xml/dom/parsing-header.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/xml/dom/parsing-header.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_XML_DOM_PARSING_HEADER_HXX 6 | #define XSD_CXX_XML_DOM_PARSING_HEADER_HXX 7 | 8 | namespace xsd 9 | { 10 | namespace cxx 11 | { 12 | namespace xml 13 | { 14 | namespace dom 15 | { 16 | template 17 | class parser; 18 | } 19 | } 20 | } 21 | } 22 | 23 | #endif // XSD_CXX_XML_DOM_PARSING_HEADER_HXX 24 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/xml/dom/wildcard-source.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/xml/dom/wildcard-source.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_XML_DOM_WILDCARD_SOURCE_HXX 6 | #define XSD_CXX_XML_DOM_WILDCARD_SOURCE_HXX 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace xsd 13 | { 14 | namespace cxx 15 | { 16 | namespace xml 17 | { 18 | namespace dom 19 | { 20 | template 21 | XSD_DOM_AUTO_PTR 22 | create_document (); 23 | } 24 | } 25 | } 26 | } 27 | 28 | #include 29 | 30 | #endif // XSD_CXX_XML_DOM_WILDCARD_SOURCE_HXX 31 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/xml/dom/wildcard-source.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/xml/dom/wildcard-source.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #include // chLatin_L, etc 6 | 7 | #include 8 | #include 9 | 10 | namespace xsd 11 | { 12 | namespace cxx 13 | { 14 | namespace xml 15 | { 16 | namespace dom 17 | { 18 | template 19 | XSD_DOM_AUTO_PTR 20 | create_document () 21 | { 22 | const XMLCh ls[] = {xercesc::chLatin_L, 23 | xercesc::chLatin_S, 24 | xercesc::chNull}; 25 | 26 | // Get an implementation of the Load-Store (LS) interface. 27 | // 28 | xercesc::DOMImplementation* impl ( 29 | xercesc::DOMImplementationRegistry::getDOMImplementation (ls)); 30 | 31 | return XSD_DOM_AUTO_PTR ( 32 | impl->createDocument ()); 33 | } 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/xml/elements.txx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/xml/elements.txx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | namespace xsd 6 | { 7 | namespace cxx 8 | { 9 | namespace xml 10 | { 11 | // properties 12 | // 13 | 14 | template 15 | void properties:: 16 | schema_location (const std::basic_string& ns, 17 | const std::basic_string& loc) 18 | { 19 | if (ns.empty () || loc.empty ()) 20 | throw argument (); 21 | 22 | if (!schema_location_.empty ()) 23 | schema_location_ += C (' '); 24 | 25 | schema_location_ += ns + C (' ') + loc; 26 | } 27 | 28 | template 29 | void properties:: 30 | no_namespace_schema_location (const std::basic_string& loc) 31 | { 32 | if (loc.empty ()) 33 | throw argument (); 34 | 35 | if (!no_namespace_schema_location_.empty ()) 36 | no_namespace_schema_location_ += C (' '); 37 | 38 | no_namespace_schema_location_ += loc; 39 | } 40 | 41 | 42 | // 43 | // 44 | 45 | template 46 | std::basic_string 47 | prefix (const std::basic_string& n) 48 | { 49 | std::size_t i (0); 50 | 51 | while (i < n.length () && n[i] != ':') 52 | ++i; 53 | 54 | return std::basic_string (n, i == n.length () ? i : 0, i); 55 | } 56 | 57 | template 58 | std::basic_string 59 | uq_name (const std::basic_string& n) 60 | { 61 | std::size_t i (0); 62 | 63 | while (i < n.length () && n[i] != ':') 64 | ++i; 65 | 66 | return std::basic_string ( 67 | n.c_str () + (i == n.length () ? 0 : i + 1)); 68 | } 69 | } 70 | } 71 | } 72 | 73 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/xml/error-handler.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/xml/error-handler.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_XML_ERROR_HANDLER_HXX 6 | #define XSD_CXX_XML_ERROR_HANDLER_HXX 7 | 8 | #include 9 | 10 | namespace xsd 11 | { 12 | namespace cxx 13 | { 14 | namespace xml 15 | { 16 | template 17 | class error_handler 18 | { 19 | public: 20 | virtual 21 | ~error_handler () 22 | { 23 | } 24 | 25 | public: 26 | 27 | // The fatal severity level results in termination 28 | // of the parsing process no matter what is returned 29 | // from handle. 30 | // 31 | struct severity 32 | { 33 | enum value 34 | { 35 | warning, 36 | error, 37 | fatal 38 | }; 39 | 40 | severity (value v) : v_ (v) {} 41 | operator value () const { return v_; } 42 | 43 | private: 44 | value v_; 45 | }; 46 | 47 | virtual bool 48 | handle (const std::basic_string& id, 49 | unsigned long line, 50 | unsigned long column, 51 | severity, 52 | const std::basic_string& message) = 0; 53 | }; 54 | } 55 | } 56 | } 57 | 58 | #endif // XSD_CXX_XML_ERROR_HANDLER_HXX 59 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/xml/exceptions.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/xml/exceptions.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_XML_EXCEPTIONS_HXX 6 | #define XSD_CXX_XML_EXCEPTIONS_HXX 7 | 8 | namespace xsd 9 | { 10 | namespace cxx 11 | { 12 | namespace xml 13 | { 14 | struct invalid_utf16_string {}; 15 | } 16 | } 17 | } 18 | 19 | #endif // XSD_CXX_XML_EXCEPTIONS_HXX 20 | -------------------------------------------------------------------------------- /xsd-4.0.0/xsd/cxx/xml/std-memory-manager.hxx: -------------------------------------------------------------------------------- 1 | // file : xsd/cxx/xml/std-memory-manager.hxx 2 | // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 | 5 | #ifndef XSD_CXX_XML_STD_MEMORY_MANAGER_HXX 6 | #define XSD_CXX_XML_STD_MEMORY_MANAGER_HXX 7 | 8 | #include // operator new, delete 9 | #include 10 | 11 | namespace xsd 12 | { 13 | namespace cxx 14 | { 15 | namespace xml 16 | { 17 | class std_memory_manager: public xercesc::MemoryManager 18 | { 19 | public: 20 | // Xerces-C++ MemoryManager interface. 21 | // 22 | virtual void* 23 | allocate(XMLSize_t size) 24 | { 25 | return operator new (size); 26 | } 27 | 28 | virtual void 29 | deallocate(void* p) 30 | { 31 | if (p) 32 | operator delete (p); 33 | } 34 | 35 | virtual xercesc::MemoryManager* 36 | getExceptionMemoryManager() 37 | { 38 | return xercesc::XMLPlatformUtils::fgMemoryManager; 39 | } 40 | 41 | // Standard deleter interface. 42 | // 43 | void 44 | operator() (void* p) const 45 | { 46 | if (p) 47 | operator delete (p); 48 | } 49 | }; 50 | } 51 | } 52 | } 53 | 54 | #endif // XSD_CXX_XML_STD_MEMORY_MANAGER_HXX 55 | --------------------------------------------------------------------------------