Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2664 in orxonox.OLD for orxonox/branches/chris


Ignore:
Timestamp:
Oct 27, 2004, 7:10:09 PM (20 years ago)
Author:
chris
Message:

orxonox/branches/chris: compiling alpha version of DataTank implemented, supports custom filetypes and automatic placeholder application for missing data files, precaching system with loading screen support coming soon - still missing doxygen tag though.

Location:
orxonox/branches/chris/src
Files:
1 added
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/chris/src/data_tank.h

    r2068 r2664  
     1/*
     2   orxonox - the future of 3D-vertical-scrollers
    13
    2 #ifndef DATA_TANK_H
    3 #define DATA_TANK_H
     4   Copyright (C) 2004 orx
     5
     6   This program is free software; you can redistribute it and/or modify
     7   it under the terms of the GNU General Public License as published by
     8   the Free Software Foundation; either version 2, or (at your option)
     9   any later version.
     10
     11   This program is distributed in the hope that it will be useful,
     12   but WITHOUT ANY WARRANTY; without even the implied warranty of
     13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14   GNU General Public License for more details.
     15
     16   You should have received a copy of the GNU General Public License
     17   along with this program; if not, write to the Free Software Foundation,
     18   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
    419
    520
    6 class DataTank {
     21   ### File Specific:
     22   main-programmer: Christian Meyer
     23   co-programmer: ...
     24*/
    725
     26#ifndef _DATA_TANK_H
     27#define _DATA_TANK_H
     28
     29#include <string.h>
     30#include <stdio.h>
     31#include <stdlib.h>
     32
     33#define MAX_FILENAME_LENGHT 64
     34#define POSTFIX_LENGHT 5
     35
     36typedef struct DataTree
     37{
     38        struct DataTree *up, *down, *parent;
     39        char filename[MAX_FILENAME_LENGHT];
     40        void* resource;
     41        int type;
     42} DataTree;
     43
     44class DataLoader
     45{
     46 private:
     47        void*(**load_funcs)(char*);
     48        void(**free_funcs)(void*);
     49        char** postfixes;
     50        void** placeholders;
     51       
     52        int ntypes;
     53         
    854 public:
    9   DataTank ();
    10   ~DataTank ();
     55        DataLoader();
     56        ~DataLoader();
     57       
     58        int add_filetype( char* postfix, void*(*lfunc)(char*), void(*ffunc)(void*), char* placeholderfile);
     59        void* load_file( char* file, int type);
     60        int get_type( char* file);
     61        void* get_placeholder( int type);
     62        void free_file( void* resource, int type);
     63};
    1164
     65class DataTank
     66{
     67 private:
     68       
     69        // resources stored in binary tree structure
     70        DataTree* tree;
     71       
     72        // data loader
     73        DataLoader* loader;
     74       
     75        // tree functions
     76        void tree_add( void* r, char* filename, int type);
     77        DataTree* tree_find( char* file);
     78        void tree_remove( DataTree* rem);
     79        void tree_delete();
     80       
     81 public:
     82        DataTank();
     83        ~DataTank();
     84       
     85        void* get( char* file);
     86        void unload( char* file);
     87        int add_filetype( char* postfix, void*(*lfunc)(char*), void(*ffunc)(void*), char* placeholderfile);
     88        void precache( char* resfile, void(*pfunc)(int, float, char*, char*));
     89        void save_precache( char* file);
     90        void save_node( DataTree* act, FILE* out);
     91        DataTree* tree_highest( DataTree* t);
     92        DataTree* tree_lowest( DataTree* t);
    1293};
    1394
Note: See TracChangeset for help on using the changeset viewer.