1 /* 2 * Copyright 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef IMG_UTILS_SORTED_ENTRY_VECTOR_H 18 #define IMG_UTILS_SORTED_ENTRY_VECTOR_H 19 20 #include <img_utils/TiffEntry.h> 21 22 #include <utils/StrongPointer.h> 23 #include <utils/SortedVector.h> 24 25 namespace android { 26 namespace img_utils { 27 28 /** 29 * Subclass of SortedVector that has been extended to 30 * do comparisons/lookups based on the tag ID of the entries. 31 */ 32 class SortedEntryVector : public SortedVector<sp<TiffEntry> > { 33 public: 34 virtual ~SortedEntryVector(); 35 36 /** 37 * Returns the index of the entry with the given tag ID, or 38 * -1 if none exists. 39 */ 40 ssize_t indexOfTag(uint16_t tag) const; 41 42 protected: 43 /** 44 * Compare tag ID. 45 */ 46 virtual int do_compare(const void* lhs, const void* rhs) const; 47 }; 48 49 50 } /*namespace img_utils*/ 51 } /*namespace android*/ 52 53 #endif /*IMG_UTILS_SORTED_ENTRY_VECTOR_H*/ 54