root/components/FileInput/trunk/FileInput/FileInput.h @ 6171

Revision 6171, 3.0 KB (checked in by balister, 5 years ago)

Add property to select file type (text, binary, etc).

Line 
1/****************************************************************************
2
3Copyright 2006, 2008 Virginia Polytechnic Institute and State University
4
5This file is part of the OSSIE FileInput.
6
7OSSIE FileInput is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
11
12OSSIE FileInput is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OSSIE FileInput; if not, write to the Free Software
19Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
21****************************************************************************/
22
23
24#ifndef FILEINPUT_IMPL_H
25#define FILEINPUT_IMPL_H
26
27#ifdef HAVE_STDLIB_H
28#include <stdlib.h>
29#endif
30#ifdef HAVE_TIME_H
31#include <time.h>
32#endif
33
34#include "ossie/cf.h"
35#include "ossie/PortTypes.h"
36#include "ossie/Resource_impl.h"
37
38#include "standardinterfaces/complexShort_u.h"
39
40class FileInput_i : public virtual Resource_impl
41{
42    public:
43        FileInput_i(const char *uuid, omni_condition *sem);
44
45        void post_constructor(CF::Resource_ptr ref) { myObjectRef = ref; };
46        static void run(void *data) { ((FileInput_i *)data)->process_data(); };
47
48        void start() throw (CF::Resource::StartError, CORBA::SystemException);
49        void stop() throw (CF::Resource::StopError, CORBA::SystemException);
50
51        CORBA::Object_ptr getPort( const char* portName ) throw (CF::PortSupplier::UnknownPort, CORBA::SystemException);
52
53        void releaseObject() throw (CF::LifeCycle::ReleaseError, CORBA::SystemException);
54
55        void initialize() throw (CF::LifeCycle::InitializeError, CORBA::SystemException);
56        void configure(const CF::Properties&) throw (CORBA::SystemException, CF::PropertySet::InvalidConfiguration, CF::PropertySet::PartialConfiguration);
57        void query (CF::Properties & configProperties) throw (CORBA::SystemException, CF::UnknownProperties);
58
59        void runTest (CORBA::ULong _number, CF::Properties & _props) throw (CORBA::SystemException, CF::TestableObject::UnknownTest, CF::UnknownProperties);
60
61
62    private:
63        FileInput_i();
64        FileInput_i(const FileInput_i&);
65   
66        void process_data();
67
68        void delay(struct timespec waitTime);
69
70        CF::Resource_var myObjectRef;
71
72        omni_condition *component_running;  //for component shutdown
73        omni_thread *processing_thread;     //for component writer function
74        omni_mutex accessPrivateData;           // for access to private data
75
76        bool running;
77
78        // Values from properties
79        std::string fileName;
80        std::string fileType;
81        unsigned long num_blocks;
82        unsigned long file_repeat;
83        struct timespec packetDelay;
84        unsigned int blockSize;
85       
86        //list components provides and uses ports
87        standardInterfaces_i::complexShort_u *dataOut;
88
89};
90#endif
Note: See TracBrowser for help on using the browser.