tool/CommandReg.cpp
author Florian Pose <fp@igh-essen.com>
Fri, 05 Feb 2010 10:29:47 +0100
changeset 1804 742607c464c4
parent 1389 5b392b22a2da
permissions -rw-r--r--
Removed tabulators.
1389
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/*****************************************************************************
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     5
 *  Copyright (C) 2006-2009  Florian Pose, Ingenieurgemeinschaft IgH
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
 *
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
 *
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it and/or
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    10
 *  modify it under the terms of the GNU General Public License version 2, as
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    11
 *  published by the Free Software Foundation.
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
 *
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    13
 *  The IgH EtherCAT Master is distributed in the hope that it will be useful,
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    16
 *  Public License for more details.
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
 *
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    18
 *  You should have received a copy of the GNU General Public License along
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    19
 *  with the IgH EtherCAT Master; if not, write to the Free Software
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
 *
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    22
 *  ---
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    23
 *
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    24
 *  The license mentioned above concerns the source code only. Using the
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
 *  EtherCAT technology and brand is only permitted in compliance with the
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
 *  industrial property and similar rights of Beckhoff Automation GmbH.
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
 *
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 ****************************************************************************/
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
#include "CommandReg.h"
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
/*****************************************************************************/
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
CommandReg::CommandReg(const string &name, const string &briefDesc):
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
    Command(name, briefDesc)
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
{
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
}
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
/****************************************************************************/
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
const CommandReg::DataType *CommandReg::findDataType(
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
        const string &str
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
        )
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
{
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
    const DataType *d;
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
    
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
    for (d = dataTypes; d->name; d++)
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
        if (str == d->name)
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
            return d;
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
    return NULL;
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
}
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    53
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
/****************************************************************************/
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
const CommandReg::DataType CommandReg::dataTypes[] = {
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
    {"int8",         1},
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
    {"int16",        2},
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
    {"int32",        4},
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    60
    {"int64",        8},
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    61
    {"uint8",        1},
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
    {"uint16",       2},
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    63
    {"uint32",       4},
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    64
    {"uint64",       8},
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
    {"string",       0},
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
    {"raw",          0},
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
    {}
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    68
};
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    69
5b392b22a2da reg_write with data types.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    70
/*****************************************************************************/