I3Identifier.cc File Reference

#include "I3Identifier.h"
#include "SHA1.h"

Go to the source code of this file.

Functions

std::ostream & operator<< (std::ostream &os, const I3Identifier &id)

Detailed Description

Author:
Antonio Zea

Definition in file I3Identifier.cc.


Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const I3Identifier id 
)
Parameters:
os String stream
id I3Identifier to be output
Returns:
os parameter

Definition at line 195 of file I3Identifier.cc.

00196 {
00197     bool allzeros;
00198     const char hex[] = "0123456789abcdef";
00199     string s0, s1;
00200 
00201     if (id.name.length() != 0) {
00202         os << "(" << id.name << ") ";
00203     }
00204 
00205     for (int i = 0; i < id.prefixLength / 8; i++) {
00206         os << hex[id.key[i] >> 4];
00207         os << hex[id.key[i] & 0xf];
00208     }
00209     os << ':';
00210 
00211     allzeros = true;
00212     for (int i = id.prefixLength / 8; i < id.keyLength / 8; i++) {
00213         if (id.key[i] != 0) {
00214             allzeros = false;
00215             break;
00216         }
00217     }
00218     if (allzeros) {
00219         os << "0...";
00220     } else {
00221         for (int i = id.prefixLength / 8; i < id.keyLength / 8; i++) {
00222             os << hex[id.key[i] >> 4];
00223             os << hex[id.key[i] & 0xf];
00224         }
00225     }
00226     return os;
00227 }

Generated on Wed May 26 16:21:15 2010 for OverSim by  doxygen 1.6.3