prep to merge blastmasters sicccobj

master
john stone 9 years ago
parent 921378da1e
commit ef1fd94da3

@ -1,77 +0,0 @@
#pragma once
#include <string>
#include <ctime>
#include <sstream>
#include <iostream>
#include <cassert>
#include "Routerin.H"
class Routerin;
class Sicobject
{
public:
Sicobject() = delete;
Sicobject(const Routerin * master) :
m_routerin(master),
m_isvalid(false)
{ }
Sicobject(const Routerin *master,
unsigned int idnum,
std::string fname,
size_t objsize,
time_t upl_date) :
m_size(objsize),
m_idnum(idnum),
m_routerin(master),
m_isvalid(true),
m_upl_date(upl_date),
m_fname(fname)
{ }
~Sicobject();
std::string get_loadurl()
{
std::string retval = "files/"; //TODO add master.get_baseurl()
//TODO: add idnum
return retval;
}
std::string get_fname()
{
return m_fname;
}
size_t get_size() { return m_size;}
std::string bytesize_string()
{
std::ostringstream strm( std::ios_base::ate);
int i = 0;
size_t size = m_size;
const char* units[] = {"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"};
while (size > 1024) {
size /= 1024;
i++;
}
assert(i < 9);
strm << size << units[i];
return strm.str();
}
private:
size_t m_size;
unsigned int m_idnum;
const Routerin * m_routerin;
bool m_isvalid;
time_t m_upl_date;
std::string m_fname;
};
Loading…
Cancel
Save