Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
graph_map.h
Package: leda.tar.gz [view]
Upload User: gzelex
Upload Date: 2007-01-07
Package Size: 707k
Code Size: 3k
Category:
Mathimatics-Numerical algorithms
Development Platform:
MultiPlatform
- /*******************************************************************************
- +
- + LEDA-R 3.2.3
- +
- + graph_map.h
- +
- + Copyright (c) 1995 by Max-Planck-Institut fuer Informatik
- + Im Stadtwald, 66123 Saarbruecken, Germany
- + All rights reserved.
- +
- *******************************************************************************/
- #ifndef LEDA_GRAPH_MAP_H
- #define LEDA_GRAPH_MAP_H
- #include <LEDA/basic.h>
- //------------------------------------------------------------------------------
- // graph_map: base type for node/edge arrays and node/edge maps
- //------------------------------------------------------------------------------
- class graph_map {
- friend class graph;
- virtual void init_entry(GenPtr&) const {}
- virtual void clear_entry(GenPtr&) const {}
- virtual void copy_entry(GenPtr&) const {}
- GenPtr* table;
- int table_size;
- const graph* g;
- int next_power(int) const;
- void resize_table(int sz);
- protected:
- void init_table(GenPtr*, GenPtr*);
- void init_table() { init_table(table,table+table_size); }
- void clear_table();
- public:
- virtual int cmp_entry(GenPtr,GenPtr) const { return 0; }
- int size() const { return table_size; }
- GenPtr& access(int i) { return table[i]; }
- GenPtr read(int i) const { return table[i]; }
- GenPtr& array_access(node v)
- {
- #if ! defined(LEDA_CHECKING_OFF)
- if (index(v) >= table_size || graph_of(v) != g)
- error_handler(999,"node_array: illegal node");
- #endif
- return table[index(v)];
- }
- GenPtr& array_access(edge e)
- {
- #if ! defined(LEDA_CHECKING_OFF)
- if (index(e) >= table_size || graph_of(e) != g)
- error_handler(999,"edge_array: illegal edge");
- #endif
- return table[index(e)];
- }
- GenPtr array_read(node v) const
- {
- #if ! defined(LEDA_CHECKING_OFF)
- if (index(v) >= table_size || graph_of(v) != g)
- error_handler(999,"node_array: illegal node");
- #endif
- return table[index(v)];
- }
- GenPtr array_read(edge e) const
- {
- #if ! defined(LEDA_CHECKING_OFF)
- if (index(e) >= table_size || graph_of(e) != g)
- error_handler(999,"edge_array: illegal edge");
- #endif
- return table[index(e)];
- }
- GenPtr& map_access(node v)
- {
- #if ! defined(LEDA_CHECKING_OFF)
- if (graph_of(v) != g) error_handler(999,"node_map: illegal node");
- #endif
- int i = index(v);
- if (i >= table_size) resize_table(next_power(i+1));
- return table[i];
- }
- GenPtr& map_access(edge e)
- {
- #if ! defined(LEDA_CHECKING_OFF)
- if (graph_of(e) != g) error_handler(999,"edge_map: illegal edge");
- #endif
- int i = index(e);
- if (i >= table_size) resize_table(next_power(i+1));
- return table[i];
- }
- GenPtr map_read(node v) const
- {
- #if ! defined(LEDA_CHECKING_OFF)
- if (graph_of(v) != g) error_handler(999,"node_map: illegal node");
- #endif
- int i = index(v);
- if (i < table_size)
- return table[i];
- else
- { GenPtr x;
- init_entry(x);
- return x;
- }
- }
- GenPtr map_read(edge e) const
- {
- #if ! defined(LEDA_CHECKING_OFF)
- if (graph_of(e) != g) error_handler(999,"edge_map: illegal edge");
- #endif
- int i = index(e);
- if (i < table_size)
- return table[i];
- else
- { GenPtr x;
- init_entry(x);
- return x;
- }
- }
- void init(const graph* G, int sz);
- graph_map(const graph* G, int sz);
- graph_map(const graph_map&);
- graph_map& operator=(const graph_map&);
- virtual ~graph_map() { delete[] table; }
- };
- #endif