Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Message.cpp

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 1999, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020                                                                         
00021 // $Revision: 1.1.1.1 $
00022 // $Date: 2000/09/15 08:23:16 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/actor/message/Message.cpp,v $
00024                                                                         
00025                                                                         
00026 // File: ~/actor/Message.C
00027 //
00028 
00029 #include "Message.h"
00030 #include <iostream.h>
00031 
00032 Message::Message()
00033 :length(0),data(0)
00034 {
00035     ;
00036 }
00037 
00038 Message::Message(double *Ptr, int size)
00039 {
00040     length = size*sizeof(double);
00041     data = (char *)Ptr;
00042 }
00043 
00044 Message::Message(int *Ptr, int size)
00045 {
00046     length = size*sizeof(int);
00047     data = (char *)Ptr;
00048 }
00049 
00050 Message::Message(char *Ptr, int size)
00051 {
00052     length = size*sizeof(char);
00053     data = Ptr;
00054 }
00055 
00056 Message::~Message()
00057 {
00058 
00059 }
00060 
00061 extern "C" void bcopy(const char *scource, char *dest, int length);
00062 
00063 int
00064 Message::putData(char *theData, int startLoc, int endLoc)
00065 {
00066     if (startLoc > 0 && startLoc <= length &&
00067  endLoc <= length && endLoc > startLoc) {
00068  int theLength = endLoc - startLoc;
00069  char *dataPos = &data[startLoc];
00070  bcopy(theData, dataPos, theLength);
00071  return 0;
00072     } else {
00073  cerr << "Message::putData() - invalid length of data given\n";
00074  return -1;
00075     }
00076 }
00077 
00078 const char *
00079 Message::getData(void)
00080 {
00081     return data;
00082 }
00083 
00084 int 
00085 Message::getSize()
00086 {
00087     return length;
00088 }
00089 
00090 
Copyright Contact Us