USGS

Isis 3.0 Application Source Code Reference

Home

KernelWriter< K > Class Template Reference

Support writting of kernels to NAIF SPICE files. More...

#include <KernelWriter.h>

List of all members.

Public Types

typedef K::SegmentType SegmentType

Public Member Functions

 KernelWriter ()
 Default constructor.
virtual ~KernelWriter ()
 Destructor.
void open (const QString &kfile, const int &commnt_size=5120)
 Open a kernel file using virtual method provided in K.
void header (const QString &comment)
 Write header with comments provided.
void write (const K &kernels)
 Write a set of kernel segments from teh Kernels segment container.
void write (const K &kernels, const QString &kfile, const QString &comfile="")
 Write a set of kernels to file and comment file.
void close ()
 Generic close method simply calls specified method.
QString getComment (const K &kernels, const QString &comfile)
 Accumulate comment from K object and individed set.

Protected Member Functions

virtual int k_open (const QString &kfile, const int &comsize=512)=0
 These virtual methods must be provided by the K class.
virtual void k_write (const SpiceInt &handle, const K &kernels)=0
virtual void k_close (SpiceInt &handle)=0
virtual QString k_header () const =0

Detailed Description

template<class K>
class Isis::KernelWriter< K >

Support writting of kernels to NAIF SPICE files.

This class is designed as the base class to support the fundamentals of opening/creating a NAIF kernel file for writing of NAIF kernel segments (typically CK and SPK types).

As such, this object provides the ability to create general files, specify comment section size, get the I/O handle associated with the output file, write comments to the kernel and then close the file when you are done.

The thing you may see as missing is the explicit write method. Due to the structure of the NAIF writing procedure, each kernel type has its own routine that has different arguments. This makes it "messy" to try and support writing of all CK/SPK types directly in this class. The template class K must provide some internal virtual methods. These methods are:

   int k_open(const QString &fname, const int commnt_size);
   void k_write(int _handle, const K kernels);
   void k_close(int handle);

The class K may also provide a WriteComment(const int handle, const QString &comment) method that will write comments to the output kernel file if the provided one is not adequate.

Author:
2010-11-10 Kris Becker

Definition at line 67 of file KernelWriter.h.


Member Typedef Documentation

typedef K::SegmentType SegmentType

Definition at line 69 of file KernelWriter.h.


Constructor & Destructor Documentation

KernelWriter (  )  [inline]

Default constructor.

Definition at line 72 of file KernelWriter.h.

virtual ~KernelWriter (  )  [inline, virtual]

Destructor.

Definition at line 74 of file KernelWriter.h.


Member Function Documentation

void open ( const QString &  kfile,
const int &  commnt_size = 5120 
) [inline]

Open a kernel file using virtual method provided in K.

Definition at line 77 of file KernelWriter.h.

void header ( const QString &  comment  )  [inline]

Write header with comments provided.

Definition at line 83 of file KernelWriter.h.

void write ( const K &  kernels  )  [inline]

Write a set of kernel segments from teh Kernels segment container.

Definition at line 88 of file KernelWriter.h.

void write ( const K &  kernels,
const QString &  kfile,
const QString &  comfile = "" 
) [inline]

Write a set of kernels to file and comment file.

This method is the typical one called to write a complete kernel file to the named file. It will write each kernel from list provided in the K list of kernels.

Parameters:
K Kernel container with segments to write
QString Name of file to write kernel to
QString Name

Definition at line 103 of file KernelWriter.h.

void close (  )  [inline]

Generic close method simply calls specified method.

Definition at line 115 of file KernelWriter.h.

QString getComment ( const K &  kernels,
const QString &  comfile 
) [inline]

Accumulate comment from K object and individed set.

Definition at line 120 of file KernelWriter.h.

virtual int k_open ( const QString &  kfile,
const int &  comsize = 512 
) [protected, pure virtual]

These virtual methods must be provided by the K class.

Implemented in SpkKernelWriter.

virtual void k_write ( const SpiceInt handle,
const K &  kernels 
) [protected, pure virtual]

Implemented in SpkKernelWriter.

virtual void k_close ( SpiceInt handle  )  [protected, pure virtual]

Implemented in SpkKernelWriter.

virtual QString k_header (  )  const [protected, pure virtual]

Implemented in SpkKernelWriter.


The documentation for this class was generated from the following file: