CLAM-Development  1.4.0
SampleMetadata.cxx
Go to the documentation of this file.
1 #include "SampleMetadata.hxx"
2 #include <sstream>
3 
4 namespace CLAM
5 {
6 
8 {
9  AddAll();
10  UpdateData();
11 
12  // any default values will be destroyed if you restore the objects from XML
13  SetFilename( "nofile" );
14  SetSortIndex(SAMPLE_METADATA_PITCH_INDEX);
15 }
16 
18 {
19  AddSortIndex();
20  UpdateData();
21 }
22 
23 bool SampleMetadata::operator<(const SampleMetadata& argSampleMetadata) const
24 {
25 
26  if (GetSortIndex() == SAMPLE_METADATA_PITCH_INDEX)
27  {
28  return GetPitch() < argSampleMetadata.GetPitch();
29  }
30  else if (GetSortIndex() == SAMPLE_METADATA_AMPLITUDE_INDEX)
31  {
32  return GetAmplitude() > argSampleMetadata.GetAmplitude();
33  }
34  else
35  {
36  std::ostringstream outStream;
37  outStream << std::string("SampleMetadata: unsupported argument for GetSortIndex(): ") << GetSortIndex();
38  //CLAM_DEBUG_ASSERT( false, outStream.str() );
39  return false;
40  }
41 }
42 
43 bool SampleMetadata::operator>(const SampleMetadata& argSampleMetadata) const
44 {
45  if (GetSortIndex() == SAMPLE_METADATA_PITCH_INDEX)
46  {
47  return GetPitch() > argSampleMetadata.GetPitch();
48  }
49  else if (GetSortIndex() == SAMPLE_METADATA_AMPLITUDE_INDEX)
50  {
51  return GetAmplitude() > argSampleMetadata.GetAmplitude();
52  }
53  else
54  {
55  std::ostringstream outStream;
56  outStream << std::string("SampleMetadata: unsupported argument for GetSortIndex(): ") << GetSortIndex();
57  //CLAM_DEBUG_ASSERT( false, outStream.str() );
58  return false;
59  }
60 }
61 
62 bool SampleMetadata::operator==(const SampleMetadata& argSampleMetadata) const
63 {
64  if (GetSortIndex() == SAMPLE_METADATA_PITCH_INDEX)
65  {
66  return GetPitch() == argSampleMetadata.GetPitch();
67  }
68  else if (GetSortIndex() == SAMPLE_METADATA_AMPLITUDE_INDEX)
69  {
70  return GetAmplitude() == argSampleMetadata.GetAmplitude();
71  }
72  else
73  {
74  std::ostringstream outStream;
75  outStream << std::string("SampleMetadata: unsupported argument for GetSortIndex(): ") << GetSortIndex();
76  //CLAM_DEBUG_ASSERT( false, outStream.str() );
77  return false;
78  }
79 }
80 
81 }
82 
83