source: branches/casa-release-4_3-test02/src/HuntLocator.h@ 3025

Last change on this file since 3025 was 2731, checked in by Takeshi Nakazato, 12 years ago

New Development: No

JIRA Issue: Yes CAS-4770

Ready for Test: Yes

Interface Changes: Yes/No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Redefined Locator and its derived classes as template class.


File size: 1.4 KB
Line 
1//
2// C++ Interface: HuntLocator
3//
4// Description:
5//
6//
7// Author: Takeshi Nakazato <takeshi.nakazato@nao.ac.jp>, (C) 2012
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
12#ifndef ASAP_HUNT_LOCATOR_H
13#define ASAP_HUNT_LOCATOR_H
14
15#include "Locator.h"
16
17namespace asap {
18
19/**
20 * Implementation of locate operation by bisection search
21 * @author TakeshiNakazato
22 */
23template <class T> class HuntLocator : public Locator<T> {
24public:
25 // Default constructor.
26 HuntLocator();
27
28 // Construct with data
29 // @param[in] v pointer to input data.
30 // @param[in] n length of the data.
31 // @param[in] copystorage whether allocate internal memory or not.
32 // @see Locator::set()
33 HuntLocator(T *v, unsigned int n, bool copystorage=true);
34
35 // Destructor.
36 virtual ~HuntLocator();
37
38 // Return right hand side index of location using bisection search
39 // plus hunt algorithm.
40 // @param[in] x input value to be located.
41 // @return location as an index j.
42 // @see Locator::locate()
43 unsigned int locate(T x);
44private:
45 // Hunt algorithm
46 // @param[in] x input value to be located.
47 // @param[in,out] left input: the starting point for hunt.
48 // output: the left index of hunted region.
49 // @param[out] right the right index of hunted region.
50 void hunt(T x, unsigned int &left, unsigned int &right);
51
52 // Storage for previous result.
53 unsigned int prev_;
54};
55
56}
57
58#include "HuntLocator.tcc"
59
60#endif
Note: See TracBrowser for help on using the repository browser.