Commit d8c62469 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

basic elements print out

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 1422
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 607753e0
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id: Makefile,v 1.2 2003-12-22 09:08:55 tforb Exp $
# $Id: Makefile,v 1.3 2003-12-22 14:14:23 tforb Exp $
#
# Copyright (c) 2003 by Thomas Forbriger (BFO Schiltach)
#
......@@ -48,9 +48,8 @@ clean: ;
# library part
# ------------
LIBSRC=sffxx.cc sffxx_TCHK2.cc sffxx_TWID2.cc sffxx_TSTA2.cc sffxx_TDAT2.cc \
sffxx_cm6.cc
INCSRC=sffxx.h sffxx_diff.h sffxx_TDAT2.h
LIBSRC=sffxx.cc
INCSRC=sffxx.h
-include $(patsubst %.cc,%.d,$(LIBSRC))
......@@ -93,8 +92,9 @@ doxyview: doxyfullview doxybrief
# test code
# ---------
sffxx_tests: sffxx_tests.cc
$(CXX) -o $@ $< -I$(LOCINCLUDEDIR) -lsffxx -L$(LOCLIBDIR)
tests: sffxx_tests; $<; rm -fv $<
sfftest: sfftest.cc
$(CXX) -o $@ $< -I$(LOCINCLUDEDIR) -lsffxx -ltime++ -lgsexx \
-L$(LOCLIBDIR)
tests: sfftest; $<; rm -fv $<
# ----- END OF Makefile -----
# Doxygen configuration generated by Doxywizard version 0.1
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "SFF++ library: reading and writing SFF from C++"
PROJECT_NUMBER =
OUTPUT_DIRECTORY = docbrief
OUTPUT_LANGUAGE = English
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
HIDE_UNDOC_MEMBERS = YES
HIDE_UNDOC_CLASSES = YES
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ALWAYS_DETAILED_SEC = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
INTERNAL_DOCS = NO
CLASS_DIAGRAMS = YES
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
VERBATIM_HEADERS = YES
SHOW_INCLUDE_FILES = YES
JAVADOC_AUTOBRIEF = YES
INHERIT_DOCS = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
DISTRIBUTE_GROUP_DOC = YES
TAB_SIZE = 8
ENABLED_SECTIONS =
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
ALIASES =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ./
FILE_PATTERNS = README \
gsexx.h \
gsexx_T*cc \
gsexxcc
RECURSIVE = NO
EXCLUDE =
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
IMAGE_PATH =
INPUT_FILTER =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = YES
LATEX_OUTPUT = latex
COMPACT_LATEX = YES
PAPER_TYPE = a4wide
EXTRA_PACKAGES = pslatex
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = YES
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = YES
MAN_OUTPUT = man
MAN_EXTENSION = .3
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DOT_PATH =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
GENERATE_LEGEND = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
CGI_NAME = search.cgi
CGI_URL =
DOC_URL =
DOC_ABSPATH =
BIN_ABSPATH = /usr/local/bin/
EXT_DOC_PATHS =
# Doxygen configuration generated by Doxywizard version 0.1
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "SFF++ library: reading and writing SFF from C++"
PROJECT_NUMBER =
OUTPUT_DIRECTORY = doc
OUTPUT_LANGUAGE = English
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ALWAYS_DETAILED_SEC = YES
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
INTERNAL_DOCS = YES
CLASS_DIAGRAMS = YES
SOURCE_BROWSER = YES
INLINE_SOURCES = YES
STRIP_CODE_COMMENTS = YES
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
VERBATIM_HEADERS = YES
SHOW_INCLUDE_FILES = YES
JAVADOC_AUTOBRIEF = YES
INHERIT_DOCS = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
DISTRIBUTE_GROUP_DOC = YES
TAB_SIZE = 8
ENABLED_SECTIONS = internal
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
ALIASES =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ./
FILE_PATTERNS = README \
*.h \
*.cc
RECURSIVE = NO
EXCLUDE =
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
IMAGE_PATH =
INPUT_FILTER =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = YES
LATEX_OUTPUT = latex
COMPACT_LATEX = YES
PAPER_TYPE = a4wide
EXTRA_PACKAGES = pslatex
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = YES
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = YES
MAN_OUTPUT = man
MAN_EXTENSION = .3
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DOT_PATH =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
GENERATE_LEGEND = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
CGI_NAME = search.cgi
CGI_URL =
DOC_URL =
DOC_ABSPATH =
BIN_ABSPATH = /usr/local/bin/
EXT_DOC_PATHS =
/*! \file operators.cc
* \brief operators defined for libsffxx (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id: operators.cc,v 1.1 2003-12-22 14:14:24 tforb Exp $
* \author Thomas Forbriger
* \date 22/12/2003
*
* operators defined for libsffxx (implementation)
*
* Copyright (c) 2003 by Thomas Forbriger (BFO Schiltach)
*
* REVISIONS and CHANGES
* - 22/12/2003 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define TF_OPERATORS_CC_VERSION \
"TF_OPERATORS_CC V1.0 "
#define TF_OPERATORS_CC_CVSID \
"$Id: operators.cc,v 1.1 2003-12-22 14:14:24 tforb Exp $"
#include <operators.h>
namespace tf {
}
/* ----- END OF operators.cc ----- */
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sfftest.cc,v 1.1 2003-12-22 09:08:55 tforb Exp $
* $Id: sfftest.cc,v 1.2 2003-12-22 14:14:24 tforb Exp $
* \author Thomas Forbriger
* \date 21/12/2003
*
......@@ -19,82 +19,57 @@
#define SFFTEST_VERSION \
"SFFTEST V1.0 test library modules"
#define SFFTEST_CVSID \
"$Id: sfftest.cc,v 1.1 2003-12-22 09:08:55 tforb Exp $"
"$Id: sfftest.cc,v 1.2 2003-12-22 14:14:24 tforb Exp $"
#include <iostream>
#include <tfxx/commandline.h>
#include <sffxx.h>
using std::cout;
using std::cerr;
using std::endl;
int main(int iargc, char* argv[])
void test_line_functions()
{
cout << "test line functions" << endl
<< "-------------------" << endl;
// define usage information
char usage_text[]=
{
SFFTEST_VERSION "\n"
"usage: sfftest" "\n"
" or: sfftest --help|-h" "\n"
};
sff::STAT mystat;
cout << mystat.line();
cout << endl;
// define full help text
char help_text[]=
{
SFFTEST_CVSID
};
sff::SRCE mysrce;
cout << mysrce.line();
cout << endl;
// define commandline options
using namespace tfxx::cmdline;
static Declare options[]=
{
// 0: print help
{"help",arg_no,"-"},
// 1: verbose mode
{"v",arg_no,"-"},
{NULL}
};
sff::DAST mydast;
cout << mydast.line();
cout << endl;
// no arguments? print usage...
if (iargc<2)
{
cerr << usage_text << endl;
exit(0);
}
sff::INFO myinfo;
cout << myinfo.line();
cout << endl;
// collect options from commandline
Commandline cmdline(iargc, argv, options);
sff::WID2 mywid2;
cout << mywid2.line();
mywid2.station="BFO";
mywid2.channel="UGZ";
mywid2.instype="ET-19";
mywid2.nsamples=2048;
mywid2.dt=10.;
cout << mywid2.line();
cout << endl;
// help requested? print full help text...
if (cmdline.optset(0))
{
cerr << usage_text << endl;
cerr << help_text << endl;
exit(0);
}
sff::FREE myfree;
myfree.lines.push_back("Hi there!");
myfree.lines.push_back("A second free line");
myfree.write(cout);
cout << endl;
// dummy operation: print option settings
for (int iopt=0; iopt<2; iopt++)
{
cout << "option: '" << options[iopt].opt_string << "'" << endl;
if (cmdline.optset(iopt)) { cout << " option was set"; }
else { cout << "option was not set"; }
cout << endl;
cout << " argument (string): '" << cmdline.string_arg(iopt) << "'" << endl;
cout << " argument (int): '" << cmdline.int_arg(iopt) << "'" << endl;
cout << " argument (long): '" << cmdline.long_arg(iopt) << "'" << endl;
cout << " argument (float): '" << cmdline.float_arg(iopt) << "'" << endl;
cout << " argument (double): '" << cmdline.double_arg(iopt) << "'" << endl;
cout << " argument (bool): '";
if (cmdline.bool_arg(iopt))
{ cout << "true"; } else { cout << "false"; }
cout << "'" << endl;
}
while (cmdline.extra()) { cout << cmdline.next() << endl; }
} // test_line_functions()
// dummy operation: print rest of command line
while (cmdline.extra()) { cout << cmdline.next() << endl; }
int main(int iargc, char* argv[])
{
test_line_functions();
}
/* ----- END OF sfftest.cc ----- */
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sffxx.cc,v 1.1 2003-12-22 09:08:56 tforb Exp $
* $Id: sffxx.cc,v 1.2 2003-12-22 14:14:25 tforb Exp $
* \author Thomas Forbriger
* \date 21/12/2003
*
......@@ -19,38 +19,192 @@
#define TF_SFFXX_CC_VERSION \
"TF_SFFXX_CC V1.0 "
#define TF_SFFXX_CC_CVSID \
"$Id: sffxx.cc,v 1.1 2003-12-22 09:08:56 tforb Exp $"
"$Id: sffxx.cc,v 1.2 2003-12-22 14:14:25 tforb Exp $"
#include <sffxx.h>
#include <gsexx.h>
namespace sff {
//! Fortran library version (to ensure compatibility)
const double libversion=1.09;
const double STAT::libversion=1.09;
const char* const STAT::LINEID="STAT";
const char* const FREE::LINEID="FREE";
const char* const SRCE::LINEID="SRCE";
const char* const DAST::LINEID="DAST";
const char* const INFO::LINEID="INFO";
/*----------------------------------------------------------------------*/
char coosysID(const Ecoosys& csid)
{
char retval;
if (csid == CS_cartesian) retval='C';
else if (csid == CS_spherical) retval='S';
else throw
GSE::Terror("ERROR (sff::coosysID): library inconsistency!");
GSE2::Terror("ERROR (sff::coosysID): library inconsistency!");
return(retval);
} // coosysID
Ecoosys coosysID(const char& csid)
{
if (csid.substr(0,1)==std::string("C")) { Fsubformat=SF_CM6; }
Ecoosys retval;
if (csid=='C') { retval=CS_cartesian; }
else if (csid=='S') { retval=CS_spherical; }
else throw
Terror("ERROR (TWID2): unknown subformat key!");
GSE2::Terror("ERROR (sff::coosysID): unknown coordinate system key!");
return(retval);
} // coosysID
/*======================================================================*/
// SFF structs
// -----------
//
// STAT
// ----
STAT::STAT(): hasfree(false), hassrce(false)
{ setstamp(libtime::now()); }
void STAT::setstamp(const libtime::TAbsoluteTime& date) const
{
char stamp[14];
int yeardigits, century;
century=int(date.year()/100);
yeardigits=date.year()-100*century;
sprintf(stamp, "%2.2i%2.2li%2.2li.%2.2li%2.2li%2.2li",
yeardigits, date.month(), date.day(),
date.hour(), date.minute(), date.second());
timestamp=std::string(stamp);
}
std::string STAT::line() const
{
this->setstamp(libtime::now());
char charline[40];
std::string code("");
if (this->hasfree) { code.append("F"); }
if (this->hassrce) { code.append("S"); }
sprintf(charline, "%4s %6.2f %13s %10s\n",
STAT::LINEID,
STAT::libversion,
timestamp.c_str(),
code.c_str());
std::string retval(charline);
return(retval);
} // STAT::line()
/*----------------------------------------------------------------------*/
// SRCE
// ----
SRCE::SRCE():
type("NSP"), date(libtime::now()),
cs(CS_cartesian), cx(0.), cy(0.), cz(0.) { }
std::string SRCE::line() const
{
char charline[95];
int yeardigits, century;
century=int(date.year()/100);
yeardigits=date.year()-100*century;
sprintf(charline, "%4s %20s %1c %15.6f%15.6f%15.6f "
"%2.2i%2.2li%2.2li %2.2li%2.2li%2.2li.%3.3li\n",
SRCE::LINEID,
type.c_str(),
coosysID(cs), cx, cy, cz,
yeardigits, date.month(), date.day(),
date.hour(), date.minute(), date.second(), date.milsec());
std::string retval(charline);
return(retval);
} // SRCE::line()
/*----------------------------------------------------------------------*/
// DAST
// ----
DAST::DAST():
nchar(-1), ampfac(1.), hasfree(false),
hasinfo(false), last(false) { }
std::string DAST::line() const
{
char charline[50];
std::string code("");
if (this->hasfree) { code.append("F"); }
if (this->hasinfo) { code.append("I"); }
if (!this->last) { code.append("D"); }
sprintf(charline, "%4s %10i %16.6e %10s\n",
DAST::LINEID,
nchar, ampfac, code.c_str());
std::string retval(charline);
return(retval);
} // DAST::line()