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-2012, 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 #include "ios_state.h"
00025 
00026 namespace Barry {
00027 
00028 std::istream& operator>>(std::istream &is, Pin &pin)
00029 {
00030         ios_format_state state(is);
00031 
00032         uint32_t newpin;
00033         is >> std::hex >> newpin;
00034         if( is )
00035                 pin = newpin;
00036         return is;
00037 }
00038 
00039 std::string Pin::Str() const
00040 {
00041         std::ostringstream oss;
00042         oss << std::hex << pin;
00043         return oss.str();
00044 }
00045 
00046 }
00047