author | Florian Pose <fp@igh-essen.com> |
Wed, 06 Feb 2013 17:48:54 +0100 | |
branch | stable-1.5 |
changeset 2509 | 232831b6249b |
parent 2010 | 87de63b19e4c |
permissions | -rw-r--r-- |
1826
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/***************************************************************************** |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
* Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
* |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT Master. |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
* |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
* The IgH EtherCAT Master is free software; you can redistribute it and/or |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
* modify it under the terms of the GNU General Public License version 2, as |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
* published by the Free Software Foundation. |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
* |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
* The IgH EtherCAT Master is distributed in the hope that it will be useful, |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
* Public License for more details. |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
* |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
* You should have received a copy of the GNU General Public License along |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
* with the IgH EtherCAT Master; if not, write to the Free Software |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
* |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
* --- |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
* |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
* The license mentioned above concerns the source code only. Using the |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
* EtherCAT technology and brand is only permitted in compliance with the |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
* industrial property and similar rights of Beckhoff Automation GmbH. |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
* |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
****************************************************************************/ |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
|
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
#include <list> |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
using namespace std; |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
|
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
/*****************************************************************************/ |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
|
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
class NumberListParser |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
{ |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
public: |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
NumberListParser(); |
1829 | 39 |
virtual ~NumberListParser(); |
1826
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
|
2010
87de63b19e4c
Implemented ranges for slaves, configs and domains.
Florian Pose <fp@igh-essen.com>
parents:
1829
diff
changeset
|
41 |
typedef list<unsigned int> List; |
1826
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
|
2010
87de63b19e4c
Implemented ranges for slaves, configs and domains.
Florian Pose <fp@igh-essen.com>
parents:
1829
diff
changeset
|
43 |
List parse(const char *); |
1826
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
|
2010
87de63b19e4c
Implemented ranges for slaves, configs and domains.
Florian Pose <fp@igh-essen.com>
parents:
1829
diff
changeset
|
45 |
virtual int getMax() = 0; |
1826
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
|
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
private: |
2010
87de63b19e4c
Implemented ranges for slaves, configs and domains.
Florian Pose <fp@igh-essen.com>
parents:
1829
diff
changeset
|
48 |
int max; |
1826
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
bool hasMax; |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
|
2010
87de63b19e4c
Implemented ranges for slaves, configs and domains.
Florian Pose <fp@igh-essen.com>
parents:
1829
diff
changeset
|
51 |
int maximum(); |
1826
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
|
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
static bool isNumeric(char); |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
static unsigned int parseNumber(const char *, unsigned int *, |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
unsigned int); |
2010
87de63b19e4c
Implemented ranges for slaves, configs and domains.
Florian Pose <fp@igh-essen.com>
parents:
1829
diff
changeset
|
56 |
static List range(unsigned int, unsigned int); |
1826
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
}; |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
|
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
/****************************************************************************/ |