source: GTP/trunk/Lib/Vis/Preprocessing/src/GzBinFileInputStream.cpp @ 1001

Revision 1001, 5.0 KB checked in by mattausch, 18 years ago (diff)

added mesh instance support
improved support for occlusion queries + other extensions

RevLine 
[971]1/*
2 * Copyright 1999-2000,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * $Log: GzBinFileInputStream.cpp,v $
19 * Revision 1.5  2004/09/08 13:56:21  peiyongz
20 * Apache License Version 2.0
21 *
22 * Revision 1.4  2003/12/17 13:58:02  cargilld
23 * Platform update for memory management so that the static memory manager (one
24 * used to call Initialize) is only for static data.
25 *
26 * Revision 1.3  2003/05/16 03:11:22  knoaman
27 * Partial implementation of the configurable memory manager.
28 *
29 * Revision 1.2  2002/11/04 15:22:03  tng
30 * C++ Namespace Support.
31 *
32 * Revision 1.1.1.1  2002/02/01 22:22:09  peiyongz
33 * sane_include
34 *
35 * Revision 1.3  2000/03/02 19:54:38  roddey
36 * This checkin includes many changes done while waiting for the
37 * 1.1.0 code to be finished. I can't list them all here, but a list is
38 * available elsewhere.
39 *
40 * Revision 1.2  2000/02/06 07:48:01  rahulj
41 * Year 2K copyright swat.
42 *
43 * Revision 1.1.1.1  1999/11/09 01:03:59  twl
44 * Initial checkin
45 *
46 * Revision 1.4  1999/11/08 20:56:55  droddey
47 * If the main xml entity does not exist, we need to get the error handling for that
48 * inside the main XMLScanner::scanDocument() try block so that it gets reported
49 * in the normal way. We have to add a little extra safety code because, when this
50 * happens, there is no reader on the reader stack to get position ino from.
51 *
52 * Revision 1.3  1999/11/08 20:45:03  rahul
53 * Swat for adding in Product name and CVS comment log variable.
54 *
55 */
56
57
58// ---------------------------------------------------------------------------
59//  Includes
60// ---------------------------------------------------------------------------
61#include <xercesc/util/BinFileInputStream.hpp>
62#include <xercesc/util/Janitor.hpp>
63#include <xercesc/util/PlatformUtils.hpp>
64#include <xercesc/util/XMLExceptMsgs.hpp>
65#include <xercesc/util/XMLString.hpp>
66
67#include "GzBinFileInputStream.h"
[975]68#include "common.h"
[971]69
70XERCES_CPP_NAMESPACE_BEGIN
71
72// ---------------------------------------------------------------------------
73//  GzBinFileInputStream: Constructors and Destructor
74// ---------------------------------------------------------------------------
75GzBinFileInputStream::GzBinFileInputStream(const XMLCh* const fileName
76                                       , MemoryManager* const manager) :
[975]77//fSource(0) ,
78fMemoryManager(manager),
79mCurrentPos(0)
[971]80{
81        // Try to open the file
[975]82    //fSource = XMLPlatformUtils::openFile(fileName, manager);
83        // todo: delete xmlstring
[971]84        char *myFileName = XMLString::transcode(fileName);
[975]85        //mStream.open(myFileName, ios::binary);
[971]86        mStream.open(myFileName);
[1001]87
88        delete [] myFileName;
[971]89}
90
91GzBinFileInputStream::GzBinFileInputStream(const char* const fileName,
92                                                                                   MemoryManager* const manager) :
[975]93fMemoryManager(manager),
94mCurrentPos(0)
[971]95{
96    // Try to open the file
[975]97        //mStream.open(fileName, ios::binary);
[971]98        mStream.open(fileName);
99}
100
101
102GzBinFileInputStream::~GzBinFileInputStream()
103{
104   mStream.close();
105}
106
107
108// ---------------------------------------------------------------------------
109//  GzBinFileInputStream: Getter methods
110// ---------------------------------------------------------------------------
111unsigned int GzBinFileInputStream::getSize() const
112{
113        // todo
114    return 0;
115}
116
117
118// ---------------------------------------------------------------------------
119//  GzBinFileInputStream: Stream management methods
120// ---------------------------------------------------------------------------
121void GzBinFileInputStream::reset()
122{
123        // todo
124}
125
126
127// ---------------------------------------------------------------------------
128//  GzBinFileInputStream: Implementation of the input stream interface
129// ---------------------------------------------------------------------------
130unsigned int GzBinFileInputStream::curPos() const
131{
[975]132    //return XMLPlatformUtils::curFilePos(fSource, fMemoryManager);
133        return mCurrentPos;
[971]134}
135
[975]136unsigned int GzBinFileInputStream::readBytes(XMLByte* const  toFill,
137                                                                                         const unsigned int maxToRead)
[971]138{
139    //
140    //  Read up to the maximum bytes requested. We return the number
141    //  actually read.
142    //
[975]143    //unsigned int result = XMLPlatformUtils::readFileBuffer(fSource, maxToRead, toFill, fMemoryManager);
144        mStream.read((char *)toFill, maxToRead);
145       
146        unsigned int result = mStream.gcount();
147        mCurrentPos = mStream.tellg();
[1001]148        //GtpVisibilityPreprocessor::Debug << "stream: " << maxToRead << " " << toFill << " " << result << endl;
[975]149
150        return result;
[971]151}
152
153XERCES_CPP_NAMESPACE_END
Note: See TracBrowser for help on using the repository browser.