SampleMetadata.cxx
Go to the documentation of this file.00001 #include "SampleMetadata.hxx"
00002 #include <sstream>
00003
00004 namespace CLAM
00005 {
00006
00007 void SampleMetadata::DefaultInit()
00008 {
00009 AddAll();
00010 UpdateData();
00011
00012
00013 SetFilename( "nofile" );
00014 SetSortIndex(SAMPLE_METADATA_PITCH_INDEX);
00015 }
00016
00017 void SampleMetadata::ConfigureAfterRestore()
00018 {
00019 AddSortIndex();
00020 UpdateData();
00021 }
00022
00023 bool SampleMetadata::operator<(const SampleMetadata& argSampleMetadata) const
00024 {
00025
00026 if (GetSortIndex() == SAMPLE_METADATA_PITCH_INDEX)
00027 {
00028 return GetPitch() < argSampleMetadata.GetPitch();
00029 }
00030 else if (GetSortIndex() == SAMPLE_METADATA_AMPLITUDE_INDEX)
00031 {
00032 return GetAmplitude() > argSampleMetadata.GetAmplitude();
00033 }
00034 else
00035 {
00036 std::ostringstream outStream;
00037 outStream << std::string("SampleMetadata: unsupported argument for GetSortIndex(): ") << GetSortIndex();
00038
00039 return false;
00040 }
00041 }
00042
00043 bool SampleMetadata::operator>(const SampleMetadata& argSampleMetadata) const
00044 {
00045 if (GetSortIndex() == SAMPLE_METADATA_PITCH_INDEX)
00046 {
00047 return GetPitch() > argSampleMetadata.GetPitch();
00048 }
00049 else if (GetSortIndex() == SAMPLE_METADATA_AMPLITUDE_INDEX)
00050 {
00051 return GetAmplitude() > argSampleMetadata.GetAmplitude();
00052 }
00053 else
00054 {
00055 std::ostringstream outStream;
00056 outStream << std::string("SampleMetadata: unsupported argument for GetSortIndex(): ") << GetSortIndex();
00057
00058 return false;
00059 }
00060 }
00061
00062 bool SampleMetadata::operator==(const SampleMetadata& argSampleMetadata) const
00063 {
00064 if (GetSortIndex() == SAMPLE_METADATA_PITCH_INDEX)
00065 {
00066 return GetPitch() == argSampleMetadata.GetPitch();
00067 }
00068 else if (GetSortIndex() == SAMPLE_METADATA_AMPLITUDE_INDEX)
00069 {
00070 return GetAmplitude() == argSampleMetadata.GetAmplitude();
00071 }
00072 else
00073 {
00074 std::ostringstream outStream;
00075 outStream << std::string("SampleMetadata: unsupported argument for GetSortIndex(): ") << GetSortIndex();
00076
00077 return false;
00078 }
00079 }
00080
00081 }
00082
00083