00001 /* 00002 * Copyright (c) 2005 MyARM GbR, Germany 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or 00006 * without modification, are permitted provided that the 00007 * following conditions are met: 00008 * 1. Redistributions of source code must retain the above 00009 * copyright notice, this list of conditions and the 00010 * following disclaimer. 00011 * 2. Redistributions in binary form must reproduce the above 00012 * copyright notice, this list of conditions and the 00013 * following disclaimer in the documentation and/or other 00014 * materials provided with the distribution. 00015 * 3. All advertising materials mentioning features or use of 00016 * this software must display the following acknowledgement: 00017 * This product includes software developed by 00018 * MyARM GbR and its contributors. 00019 * 4. Neither the name of MyARM GbR nor the names of its 00020 * contributors may be used to endorse or promote products 00021 * derived from this software without specific prior written 00022 * permission. 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY MYARM GBR. AND CONTRIBUTORS 00025 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 00026 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00027 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00028 * SHALL MYARM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 00029 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00030 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00031 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 00032 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00033 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00034 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 00035 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00036 * OF SUCH DAMAGE. 00037 */ 00038 00039 #ifndef QARMMETRICLIST_H 00040 #define QARMMETRICLIST_H 00041 00047 #include <QList> 00048 #include <QListIterator> 00049 00050 #include <QArmMetric> 00051 00052 // iterator 00053 typedef QListIterator<QArmMetric *> QArmMetricListIterator; 00054 00061 class QArmMetricList : public QList<QArmMetric *> 00062 { 00063 public: 00065 ~QArmMetricList(); 00066 00072 void append(QArmMetric *metric); 00073 }; 00074 00075 // INLINE METHODS 00076 inline QArmMetricList::~QArmMetricList() { 00077 // remove all items from the list (i.e. the pointers) 00078 // and deallocate the memory 00079 while (!isEmpty()) 00080 delete takeFirst(); 00081 } 00082 00083 inline void QArmMetricList::append(QArmMetric *metric) { 00084 // call register method of metric which registers the 00085 // metric with ARM. Use the current size of the list 00086 // as the slot number. 00087 metric->registerMetric(size()); 00088 00089 // append the metric now to the list 00090 QList<QArmMetric*>::append(metric); 00091 } 00092 00093 #endif
1.4.2