# pin.cc

Go to the documentation of this file.

    00001 ///
    00002 /// \file       pin.cc
    00003 ///             class for device PIN notation
    00004 ///
    00005
    00006 /*
    00007     Copyright (C) 2007-2011, Net Direct Inc. (http://www.netdirect.ca/)
    00008
    00009     This program is free software; you can redistribute it and/or modify
    00010     it under the terms of the GNU General Public License as published by
    00011     the Free Software Foundation; either version 2 of the License, or
    00012     (at your option) any later version.
    00013
    00014     This program is distributed in the hope that it will be useful,
    00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00017
    00018     See the GNU General Public License in the COPYING file at the
    00019     root directory of this project for more details.
    00020 */
    00021
    00022 #include <sstream>
    00023 #include "pin.h"
    00024
    00025 namespace Barry {
    00026
    00027 std::ostream& operator<<(std::ostream &os, const Pin &pin)
    00028 {
    00029         os << pin.Str();
    00030         return os;
    00031 }
    00032
    00033 std::istream& operator>>(std::istream &is, Pin &pin)
    00034 {
    00035         uint32_t newpin;
    00036         is >> std::hex >> newpin;
    00037         if( is )
    00038                 pin = newpin;
    00039         return is;
    00040 }
    00041
    00042 std::string Pin::Str() const
    00043 {
    00044         std::ostringstream oss;
    00045         oss << std::hex << pin;
    00046         return oss.str();
    00047 }
    00048
    00049 }
    00050