├── CHANGELOG.md ├── LICENSE ├── README.md ├── README.zh_cn.md ├── doc └── Guide.md ├── efc ├── EBase.hh ├── EUtils.hh ├── Efc.hh ├── build │ ├── Makefile_arm_libc │ ├── Makefile_unix_efc │ ├── Makefile_unix_libc │ ├── Makefile_win_efc │ ├── Makefile_win_libc │ └── genlib.bat ├── es_comm.h ├── es_config.h ├── es_main.h ├── es_status.h ├── es_types.h ├── inc │ ├── EA.hh │ ├── EAbstractCollection.hh │ ├── EAbstractList.hh │ ├── EAbstractMap.hh │ ├── EAbstractQueue.hh │ ├── EAbstractSet.hh │ ├── EAdler32.hh │ ├── EAlreadyBoundException.hh │ ├── EAlreadyConnectedException.hh │ ├── EArithmeticException.hh │ ├── EArray.hh │ ├── EArrayDeque.hh │ ├── EArrayIndexOutOfBoundsException.hh │ ├── EArrayList.hh │ ├── EArrays.hh │ ├── EAuthenticationException.hh │ ├── EBase64.hh │ ├── EBigDecimal.hh │ ├── EBigInteger.hh │ ├── EBindException.hh │ ├── EBitSet.hh │ ├── EBits.hh │ ├── EBoolean.hh │ ├── EBson.hh │ ├── EBsonParser.hh │ ├── EBufferedInputStream.hh │ ├── EBufferedOutputStream.hh │ ├── EByte.hh │ ├── EByteArrayInputStream.hh │ ├── EByteArrayOutputStream.hh │ ├── EByteBuffer.hh │ ├── ECRC32.hh │ ├── ECalendar.hh │ ├── ECharacter.hh │ ├── ECheckedInputStream.hh │ ├── ECheckedOutputStream.hh │ ├── EChecksum.hh │ ├── EClassCastException.hh │ ├── ECloseable.hh │ ├── ECollection.hh │ ├── ECollections.hh │ ├── EComparable.hh │ ├── EComparator.hh │ ├── EConcurrentModificationException.hh │ ├── ECondition.hh │ ├── EConfig.hh │ ├── EConnectException.hh │ ├── EDataFormatException.hh │ ├── EDataInput.hh │ ├── EDataInputStream.hh │ ├── EDataOutput.hh │ ├── EDataOutputStream.hh │ ├── EDatagramPacket.hh │ ├── EDatagramSocket.hh │ ├── EDate.hh │ ├── EDeflater.hh │ ├── EDeflaterOutputStream.hh │ ├── EDeque.hh │ ├── EDictionary.hh │ ├── EDouble.hh │ ├── EEOFException.hh │ ├── EEmptyStackException.hh │ ├── EEnumeration.hh │ ├── EEventListener.hh │ ├── EEventListenerProxy.hh │ ├── EEventObject.hh │ ├── EException.hh │ ├── EFile.hh │ ├── EFileFilter.hh │ ├── EFileInputStream.hh │ ├── EFileNotFoundException.hh │ ├── EFileOutputStream.hh │ ├── EFilenameFilter.hh │ ├── EFilterInputStream.hh │ ├── EFilterOutputStream.hh │ ├── EFloat.hh │ ├── EFlushable.hh │ ├── EFork.hh │ ├── EGZIPInputStream.hh │ ├── EGZIPOutputStream.hh │ ├── EHashMap.hh │ ├── EHashSet.hh │ ├── EIOException.hh │ ├── EIOStatus.hh │ ├── EIPAddressUtil.hh │ ├── EIdentityHashMap.hh │ ├── EIllegalArgumentException.hh │ ├── EIllegalBlockingModeException.hh │ ├── EIllegalStateException.hh │ ├── EIllegalThreadStateException.hh │ ├── EIndexOutOfBoundsException.hh │ ├── EInetAddress.hh │ ├── EInetSocketAddress.hh │ ├── EInflater.hh │ ├── EInflaterInputStream.hh │ ├── EInputStream.hh │ ├── EInteger.hh │ ├── EInterfaceAddress.hh │ ├── EInterruptedException.hh │ ├── EInterruptedIOException.hh │ ├── EInterruptible.hh │ ├── EIterable.hh │ ├── EIterator.hh │ ├── ELLong.hh │ ├── ELinkedList.hh │ ├── EList.hh │ ├── EListIterator.hh │ ├── ELock.hh │ ├── ELockPool.hh │ ├── EMalformedURLException.hh │ ├── EMap.hh │ ├── EMatchResult.hh │ ├── EMatcher.hh │ ├── EMath.hh │ ├── EMulticastSocket.hh │ ├── ENavigableMap.hh │ ├── ENavigableSet.hh │ ├── ENetWrapper.hh │ ├── ENetworkInterface.hh │ ├── ENoConnectionPendingException.hh │ ├── ENoRouteToHostException.hh │ ├── ENoSuchElementException.hh │ ├── ENotYetBoundException.hh │ ├── ENotYetConnectedException.hh │ ├── ENullPointerException.hh │ ├── ENumber.hh │ ├── ENumberFormatException.hh │ ├── EOS.hh │ ├── EObject.hh │ ├── EObservable.hh │ ├── EObserver.hh │ ├── EOutOfMemoryError.hh │ ├── EOutputStream.hh │ ├── EPattern.hh │ ├── EPatternSyntaxException.hh │ ├── EPipedInputStream.hh │ ├── EPipedOutputStream.hh │ ├── EPortUnreachableException.hh │ ├── EPrintStream.hh │ ├── EPriorityQueue.hh │ ├── EProcess.hh │ ├── EProperties.hh │ ├── EProtocolException.hh │ ├── EPushbackInputStream.hh │ ├── EQueue.hh │ ├── ERandom.hh │ ├── ERandomAccessFile.hh │ ├── EReference.hh │ ├── ERunnable.hh │ ├── ERuntime.hh │ ├── ERuntimeException.hh │ ├── ESSLCommon.hh │ ├── ESSLServerSocket.hh │ ├── ESSLSocket.hh │ ├── ESaslException.hh │ ├── ESecureRandom.hh │ ├── ESecurityException.hh │ ├── ESentry.hh │ ├── ESequenceInputStream.hh │ ├── EServerSocket.hh │ ├── ESet.hh │ ├── ESharedPtr.hh │ ├── EShort.hh │ ├── ESimpleCondition.hh │ ├── ESimpleEnumeration.hh │ ├── ESimpleLock.hh │ ├── ESimpleMap.hh │ ├── ESimpleStack.hh │ ├── ESimpleVector.hh │ ├── ESocket.hh │ ├── ESocketException.hh │ ├── ESocketOptions.hh │ ├── ESocketTimeoutException.hh │ ├── ESortedMap.hh │ ├── ESortedSet.hh │ ├── ESpinLock.hh │ ├── EStack.hh │ ├── EStream.hh │ ├── EString.hh │ ├── EStringTokenizer.hh │ ├── ESynchronizeable.hh │ ├── ESystem.hh │ ├── EThread.hh │ ├── EThreadGroup.hh │ ├── EThreadLocal.hh │ ├── EThreadLocalStorage.hh │ ├── EThreadUnCInitException.hh │ ├── EThrowable.hh │ ├── ETimeUnit.hh │ ├── ETimer.hh │ ├── ETimerTask.hh │ ├── EToDoException.hh │ ├── ETraits.hh │ ├── ETreeMap.hh │ ├── ETreeSet.hh │ ├── EURI.hh │ ├── EURISyntaxException.hh │ ├── EURLDecoder.hh │ ├── EURLEncoder.hh │ ├── EURLString.hh │ ├── EUnknownHostException.hh │ ├── EUnknownServiceException.hh │ ├── EUnresolvedAddressException.hh │ ├── EUnsupportedAddressTypeException.hh │ ├── EUnsupportedEncodingException.hh │ ├── EUnsupportedOperationException.hh │ ├── EVector.hh │ ├── concurrent │ │ ├── EAbstractExecutorService.hh │ │ ├── EAbstractOwnableSynchronizer.hh │ │ ├── EAbstractQueuedSynchronizer.hh │ │ ├── EArrayBlockingQueue.hh │ │ ├── EAtomic.hh │ │ ├── EAtomicBoolean.hh │ │ ├── EAtomicCounter.hh │ │ ├── EAtomicDouble.hh │ │ ├── EAtomicInteger.hh │ │ ├── EAtomicLLong.hh │ │ ├── EAtomicReference.hh │ │ ├── EBlockingQueue.hh │ │ ├── EBrokenBarrierException.hh │ │ ├── ECallable.hh │ │ ├── ECancellationException.hh │ │ ├── ECompletionService.hh │ │ ├── EConcurrentHashMap.hh │ │ ├── EConcurrentIntrusiveDeque.hh │ │ ├── EConcurrentLinkedQueue.hh │ │ ├── EConcurrentLiteQueue.hh │ │ ├── EConcurrentMap.hh │ │ ├── EConcurrentNavigableMap.hh │ │ ├── EConcurrentSkipListMap.hh │ │ ├── EConcurrentSortedMap.hh │ │ ├── ECopyOnWriteArrayList.hh │ │ ├── ECountDownLatch.hh │ │ ├── ECyclicBarrier.hh │ │ ├── EExchanger.hh │ │ ├── EExecutionException.hh │ │ ├── EExecutor.hh │ │ ├── EExecutorCompletionService.hh │ │ ├── EExecutorService.hh │ │ ├── EExecutors.hh │ │ ├── EFuture.hh │ │ ├── EFutureTask.hh │ │ ├── ELinkedBlockingQueue.hh │ │ ├── ELinkedTransferQueue.hh │ │ ├── ELockSupport.hh │ │ ├── EMutexLinkedQueue.hh │ │ ├── EOrderAccess.hh │ │ ├── EReadWriteLock.hh │ │ ├── EReentrantLock.hh │ │ ├── EReentrantReadWriteLock.hh │ │ ├── ERejectedExecutionException.hh │ │ ├── ERejectedExecutionHandler.hh │ │ ├── ERunnableFuture.hh │ │ ├── ESemaphore.hh │ │ ├── ESynchronousQueue.hh │ │ ├── EThreadFactory.hh │ │ ├── EThreadLocalRandom.hh │ │ ├── EThreadPoolExecutor.hh │ │ ├── ETimeoutException.hh │ │ ├── ETransferQueue.hh │ │ └── EUnsafe.hh │ └── cpp11 │ │ └── EScopeGuard.hh ├── libc │ ├── inc │ │ ├── eso_alogger.h │ │ ├── eso_array.h │ │ ├── eso_array_int.h │ │ ├── eso_array_ptr.h │ │ ├── eso_atomic.h │ │ ├── eso_base64.h │ │ ├── eso_bitset.h │ │ ├── eso_bson.h │ │ ├── eso_bson_ext.h │ │ ├── eso_buffer.h │ │ ├── eso_canonicalize.h │ │ ├── eso_conf.h │ │ ├── eso_crc32.h │ │ ├── eso_datetime.h │ │ ├── eso_debug.h │ │ ├── eso_dso.h │ │ ├── eso_encode.h │ │ ├── eso_except.h │ │ ├── eso_file.h │ │ ├── eso_flip_buffer.h │ │ ├── eso_fmttime.h │ │ ├── eso_hash.h │ │ ├── eso_ini.h │ │ ├── eso_json.h │ │ ├── eso_libc.h │ │ ├── eso_locale_str.h │ │ ├── eso_lz77.h │ │ ├── eso_lzma.h │ │ ├── eso_map.h │ │ ├── eso_md4.h │ │ ├── eso_md5.h │ │ ├── eso_mem.h │ │ ├── eso_mmap.h │ │ ├── eso_mpool.h │ │ ├── eso_net.h │ │ ├── eso_object.h │ │ ├── eso_pcre.h │ │ ├── eso_pipe.h │ │ ├── eso_poll.h │ │ ├── eso_printf_upper_bound.h │ │ ├── eso_proc.h │ │ ├── eso_proc_mutex.h │ │ ├── eso_queue.h │ │ ├── eso_ring.h │ │ ├── eso_ring_buffer.h │ │ ├── eso_sha1.h │ │ ├── eso_sha2.h │ │ ├── eso_shm.h │ │ ├── eso_signal.h │ │ ├── eso_sigsegv.h │ │ ├── eso_stack.h │ │ ├── eso_string.h │ │ ├── eso_sys.h │ │ ├── eso_thread.h │ │ ├── eso_thread_cond.h │ │ ├── eso_thread_mutex.h │ │ ├── eso_thread_rwlock.h │ │ ├── eso_thread_spin.h │ │ ├── eso_util.h │ │ ├── eso_uuid.h │ │ ├── eso_vector.h │ │ └── eso_zlib.h │ ├── libc.h │ └── src │ │ ├── canonicalize_unix.inl │ │ ├── canonicalize_win.inl │ │ ├── eso_alogger.c │ │ ├── eso_array.c │ │ ├── eso_array_int.c │ │ ├── eso_array_ptr.c │ │ ├── eso_atomic.c │ │ ├── eso_base64.c │ │ ├── eso_bitset.c │ │ ├── eso_bson.c │ │ ├── eso_bson_ext.c │ │ ├── eso_buffer.c │ │ ├── eso_canonicalize.c │ │ ├── eso_conf.c │ │ ├── eso_crc32.c │ │ ├── eso_datetime.c │ │ ├── eso_debug.c │ │ ├── eso_dso.c │ │ ├── eso_encode.c │ │ ├── eso_except.c │ │ ├── eso_file.c │ │ ├── eso_flip_buffer.c │ │ ├── eso_fmttime.c │ │ ├── eso_hash.c │ │ ├── eso_ini.c │ │ ├── eso_json.c │ │ ├── eso_lz77.c │ │ ├── eso_lzma.c │ │ ├── eso_map.c │ │ ├── eso_md4.c │ │ ├── eso_md5.c │ │ ├── eso_mem.c │ │ ├── eso_mmap.c │ │ ├── eso_mpool.c │ │ ├── eso_net.c │ │ ├── eso_object.c │ │ ├── eso_pcre.c │ │ ├── eso_pipe.c │ │ ├── eso_poll.c │ │ ├── eso_printf_upper_bound.c │ │ ├── eso_proc.c │ │ ├── eso_proc_mutex.c │ │ ├── eso_queue.c │ │ ├── eso_ring_buffer.c │ │ ├── eso_sha1.c │ │ ├── eso_sha2.c │ │ ├── eso_shm.c │ │ ├── eso_signal.c │ │ ├── eso_sigsegv.c │ │ ├── eso_stack.c │ │ ├── eso_string.c │ │ ├── eso_sys.c │ │ ├── eso_thread.c │ │ ├── eso_thread_cond.c │ │ ├── eso_thread_mutex.c │ │ ├── eso_thread_rwlock.c │ │ ├── eso_thread_spin.c │ │ ├── eso_util.c │ │ ├── eso_uuid.c │ │ ├── eso_vector.c │ │ ├── eso_zlib.c │ │ ├── lzma │ │ ├── LzFind.c │ │ ├── LzFind.h │ │ ├── LzHash.h │ │ ├── LzmaDec.c │ │ ├── LzmaDec.h │ │ ├── LzmaEnc.c │ │ ├── LzmaEnc.h │ │ └── Types.h │ │ ├── pcre │ │ ├── AUTHORS │ │ ├── COPYING │ │ ├── ChangeLog │ │ ├── HACKING │ │ ├── LICENCE │ │ ├── NEWS │ │ ├── NON-UNIX-USE │ │ ├── README │ │ ├── config.h │ │ ├── doc │ │ │ └── pcre.txt │ │ ├── pcre.h │ │ ├── pcre_chartables.c │ │ ├── pcre_compile.c │ │ ├── pcre_config.c │ │ ├── pcre_exec.c │ │ ├── pcre_fullinfo.c │ │ ├── pcre_get.c │ │ ├── pcre_globals.c │ │ ├── pcre_internal.h │ │ ├── pcre_maketables.c │ │ ├── pcre_newline.c │ │ ├── pcre_ord2utf8.c │ │ ├── pcre_printint.src │ │ ├── pcre_refcount.c │ │ ├── pcre_study.c │ │ ├── pcre_tables.c │ │ ├── pcre_ucd.c │ │ ├── pcre_valid_utf8.c │ │ ├── pcre_version.c │ │ ├── pcre_xclass.c │ │ ├── testdata │ │ │ ├── grepinput │ │ │ ├── grepinput8 │ │ │ ├── grepinputx │ │ │ ├── greplist │ │ │ ├── grepoutput │ │ │ ├── grepoutput8 │ │ │ ├── grepoutputN │ │ │ ├── testinput1 │ │ │ ├── testinput10 │ │ │ ├── testinput2 │ │ │ ├── testinput3 │ │ │ ├── testinput4 │ │ │ ├── testinput5 │ │ │ ├── testinput6 │ │ │ ├── testinput7 │ │ │ ├── testinput8 │ │ │ ├── testinput9 │ │ │ ├── testoutput1 │ │ │ ├── testoutput10 │ │ │ ├── testoutput2 │ │ │ ├── testoutput3 │ │ │ ├── testoutput4 │ │ │ ├── testoutput5 │ │ │ ├── testoutput6 │ │ │ ├── testoutput7 │ │ │ ├── testoutput8 │ │ │ └── testoutput9 │ │ └── ucp.h │ │ ├── poll │ │ ├── ae_epoll.c │ │ ├── ae_evport.c │ │ ├── ae_kqueue.c │ │ └── ae_select.c │ │ ├── sample1.conf │ │ ├── sample2.conf │ │ └── zlib │ │ ├── adler32.c │ │ ├── compress.c │ │ ├── crc32.c │ │ ├── crc32.h │ │ ├── deflate.c │ │ ├── deflate.h │ │ ├── gzclose.c │ │ ├── gzguts.h │ │ ├── gzlib.c │ │ ├── gzread.c │ │ ├── gzwrite.c │ │ ├── infback.c │ │ ├── inffast.c │ │ ├── inffast.h │ │ ├── inffixed.h │ │ ├── inflate.c │ │ ├── inflate.h │ │ ├── inftrees.c │ │ ├── inftrees.h │ │ ├── trees.c │ │ ├── trees.h │ │ ├── uncompr.c │ │ ├── zconf.h │ │ ├── zlib.h │ │ ├── zutil.c │ │ └── zutil.h ├── nio │ ├── inc │ │ ├── EAsynchronousCloseException.hh │ │ ├── EBufferOverflowException.hh │ │ ├── EBufferUnderflowException.hh │ │ ├── EByteChannel.hh │ │ ├── ECancelledKeyException.hh │ │ ├── EChannel.hh │ │ ├── EChannelInputStream.hh │ │ ├── EClosedByInterruptException.hh │ │ ├── EClosedChannelException.hh │ │ ├── EClosedSelectorException.hh │ │ ├── EConnectionPendingException.hh │ │ ├── EDatagramChannel.hh │ │ ├── EFileChannel.hh │ │ ├── EFileDispatcher.hh │ │ ├── EFileKey.hh │ │ ├── EFileLock.hh │ │ ├── EIOByteBuffer.hh │ │ ├── EInterruptibleChannel.hh │ │ ├── EInvalidMarkException.hh │ │ ├── EMappedByteBuffer.hh │ │ ├── EMembershipKey.hh │ │ ├── EMulticastChannel.hh │ │ ├── ENativeThreadSet.hh │ │ ├── ENonReadableChannelException.hh │ │ ├── ENonWritableChannelException.hh │ │ ├── EOverlappingFileLockException.hh │ │ ├── EReadOnlyBufferException.hh │ │ ├── ESelectableChannel.hh │ │ ├── ESelectionKey.hh │ │ ├── ESelector.hh │ │ ├── EServerSocketChannel.hh │ │ └── ESocketChannel.hh │ └── src │ │ ├── EChannelInputStream.cpp │ │ ├── EDatagramChannel.cpp │ │ ├── EDatagramDispatcher.cpp │ │ ├── EDatagramDispatcher.hh │ │ ├── EDatagramSocketAdaptor.cpp │ │ ├── EDatagramSocketAdaptor.hh │ │ ├── EEPollArrayWrapper.cpp │ │ ├── EEPollArrayWrapper.hh │ │ ├── EEPollSelectorImpl.cpp │ │ ├── EEPollSelectorImpl.hh │ │ ├── EFileChannel.cpp │ │ ├── EFileDispatcher.cpp │ │ ├── EFileKey.cpp │ │ ├── EFileLock.cpp │ │ ├── EIOByteBuffer.cpp │ │ ├── EIONetWrapper.cpp │ │ ├── EIONetWrapper.hh │ │ ├── EInterruptibleChannel.cpp │ │ ├── EKQueueArrayWrapper.cpp │ │ ├── EKQueueArrayWrapper.hh │ │ ├── EKQueueSelectorImpl.cpp │ │ ├── EKQueueSelectorImpl.hh │ │ ├── EMappedByteBuffer.cpp │ │ ├── EMembershipKey.cpp │ │ ├── EMembershipRegistry.cpp │ │ ├── EMembershipRegistry.hh │ │ ├── ENIOUtil.cpp │ │ ├── ENIOUtil.hh │ │ ├── ENativeThread.cpp │ │ ├── ENativeThread.hh │ │ ├── ENativeThreadSet.cpp │ │ ├── EPipeWrapper.cpp │ │ ├── EPipeWrapper.hh │ │ ├── EPollArrayWrapper.cpp │ │ ├── EPollArrayWrapper.hh │ │ ├── EPollSelectorImpl.cpp │ │ ├── EPollSelectorImpl.hh │ │ ├── ESelectableChannel.cpp │ │ ├── ESelectionKey.cpp │ │ ├── ESelector.cpp │ │ ├── EServerSocketAdaptor.cpp │ │ ├── EServerSocketAdaptor.hh │ │ ├── EServerSocketChannel.cpp │ │ ├── ESocketAdaptor.cpp │ │ ├── ESocketAdaptor.hh │ │ ├── ESocketChannel.cpp │ │ ├── ESocketDispatcher.cpp │ │ └── ESocketDispatcher.hh ├── src │ ├── EAdler32.cpp │ ├── EBase64.cpp │ ├── EBigDecimal.cpp │ ├── EBigInteger.cpp │ ├── EBitSet.cpp │ ├── EBits.cpp │ ├── EBoolean.cpp │ ├── EBson.cpp │ ├── EBsonParser.cpp │ ├── EBufferedInputStream.cpp │ ├── EBufferedOutputStream.cpp │ ├── EByte.cpp │ ├── EByteArrayInputStream.cpp │ ├── EByteArrayOutputStream.cpp │ ├── EByteBuffer.cpp │ ├── ECRC32.cpp │ ├── ECalendar.cpp │ ├── ECharacter.cpp │ ├── ECheckedInputStream.cpp │ ├── ECheckedOutputStream.cpp │ ├── EConfig.cpp │ ├── EDataInputStream.cpp │ ├── EDataOutputStream.cpp │ ├── EDatagramPacket.cpp │ ├── EDatagramSocket.cpp │ ├── EDate.cpp │ ├── EDeflater.cpp │ ├── EDeflaterOutputStream.cpp │ ├── EDouble.cpp │ ├── EEventObject.cpp │ ├── EFile.cpp │ ├── EFileInputStream.cpp │ ├── EFileOutputStream.cpp │ ├── EFilterInputStream.cpp │ ├── EFilterOutputStream.cpp │ ├── EFloat.cpp │ ├── EFork.cpp │ ├── EGZIPInputStream.cpp │ ├── EGZIPOutputStream.cpp │ ├── EIPAddressUtil.cpp │ ├── EIdentityHashMap.cpp │ ├── EInetAddress.cpp │ ├── EInetSocketAddress.cpp │ ├── EInflater.cpp │ ├── EInflaterInputStream.cpp │ ├── EInputStream.cpp │ ├── EInteger.cpp │ ├── EInterfaceAddress.cpp │ ├── ELLong.cpp │ ├── EMatcher.cpp │ ├── EMath.cpp │ ├── EMulticastSocket.cpp │ ├── ENetWrapper.cpp │ ├── ENetworkInterface.cpp │ ├── EOS.cpp │ ├── EObject.cpp │ ├── EObservable.cpp │ ├── EOutputStream.cpp │ ├── EPark.cpp │ ├── EPark.hh │ ├── EPattern.cpp │ ├── EPipedInputStream.cpp │ ├── EPipedOutputStream.cpp │ ├── EPrintStream.cpp │ ├── EProcess.cpp │ ├── EProperties.cpp │ ├── EPushbackInputStream.cpp │ ├── ERandom.cpp │ ├── ERandomAccessFile.cpp │ ├── ERuntime.cpp │ ├── ESSLCommon.cpp │ ├── ESSLServerSocket.cpp │ ├── ESSLSocket.cpp │ ├── ESecureRandom.cpp │ ├── ESentry.cpp │ ├── ESequenceInputStream.cpp │ ├── EServerSocket.cpp │ ├── ESharedPtr.cpp │ ├── EShort.cpp │ ├── ESimpleCondition.cpp │ ├── ESimpleLock.cpp │ ├── ESimpleMap.cpp │ ├── ESimpleStack.cpp │ ├── ESimpleVector.cpp │ ├── ESocket.cpp │ ├── ESocketOptions.cpp │ ├── ESpinLock.cpp │ ├── EStream.cpp │ ├── EString.cpp │ ├── EStringTokenizer.cpp │ ├── ESystem.cpp │ ├── EThread.cpp │ ├── EThreadGroup.cpp │ ├── EThreadLocal.cpp │ ├── EThreadLocalStorage.cpp │ ├── EThreadService.hh │ ├── EThrowable.cpp │ ├── ETimeUnit.cpp │ ├── ETimer.cpp │ ├── ETimerTask.cpp │ ├── EURI.cpp │ ├── EURLDecoder.cpp │ ├── EURLEncoder.cpp │ ├── EURLString.cpp │ └── concurrent │ │ ├── EAbstractQueuedSynchronizer.cpp │ │ ├── EAtomic.cpp │ │ ├── EAtomicBoolean.cpp │ │ ├── EAtomicCounter.cpp │ │ ├── EAtomicDouble.cpp │ │ ├── EAtomicInteger.cpp │ │ ├── EAtomicLLong.cpp │ │ ├── ECountDownLatch.cpp │ │ ├── ECyclicBarrier.cpp │ │ ├── EExecutors.cpp │ │ ├── ELockSupport.cpp │ │ ├── EOrderAccess.cpp │ │ ├── EReentrantLock.cpp │ │ ├── EReentrantReadWriteLock.cpp │ │ ├── ESemaphore.cpp │ │ ├── EThreadLocalRandom.cpp │ │ ├── EThreadPoolExecutor.cpp │ │ └── EUnsafe.cpp └── utils │ ├── inc │ ├── EBoundedInputStream.hh │ ├── EDomainServerSocket.hh │ └── EDomainSocket.hh │ └── src │ ├── EBoundedInputStream.cpp │ ├── EDomainServerSocket.cpp │ └── EDomainSocket.cpp ├── img └── test_concurrentHashmap.gif ├── lib ├── cl_version_LE.bat ├── linux │ ├── libefc32.a │ ├── libefc64.a │ ├── libeso32.a │ └── libeso64.a ├── osx │ ├── libefc64.a │ └── libeso64.a └── win │ ├── efc16.lib │ ├── efc19.lib │ ├── eso16.lib │ └── eso19.lib └── test ├── Makefile_unix ├── Makefile_win ├── main.cpp ├── sample.conf ├── sample.ini ├── testbson.cpp ├── testc11.cpp ├── testefc.cpp ├── testlibc.cpp ├── testnio.cpp ├── testssl.cpp ├── teststr.cpp └── testutils.cpp /efc/EUtils.hh: -------------------------------------------------------------------------------- 1 | #ifndef __EUTILS_H__ 2 | #define __EUTILS_H__ 3 | 4 | #define EUTILS_VERSION "0.1.0" 5 | 6 | #include "Efc.hh" 7 | 8 | //utils 9 | #include "./utils/inc/EBoundedInputStream.hh" 10 | #include "./utils/inc/EDomainSocket.hh" 11 | #include "./utils/inc/EDomainServerSocket.hh" 12 | 13 | using namespace efc::utils; 14 | 15 | #endif /* __EUTILS_H__ */ 16 | -------------------------------------------------------------------------------- /efc/build/genlib.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem "C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat" 3 | rem "C:\Program Files\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat" 4 | 5 | echo =============================== 6 | echo make win eso8.lib 7 | echo =============================== 8 | rem ..\..\tools\bmake.exe -f Makefile_win all 9 | nmake.exe -f Makefile_win all 10 | 11 | echo =============================== 12 | echo make arm libeso_l.a 13 | echo =============================== 14 | rem ..\..\tools\bmake.exe -DLIBNAME=libeso_l.a -DENDIANMODE=littleend -f Makefile_arm all 15 | nmake.exe -DLIBNAME=libeso_l.a -DENDIANMODE=littleend -f Makefile_arm all 16 | 17 | pause 18 | -------------------------------------------------------------------------------- /efc/es_config.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file es_config.h 3 | * @brief ES Prefix Definitions 4 | */ 5 | 6 | #ifndef ES_CONFIG_H_ 7 | #define ES_CONFIG_H_ 8 | 9 | #ifdef WIN32 10 | 11 | #define WIN32_LEAN_AND_MEAN //@see: http://www.cppblog.com/tx7do/archive/2008/04/20/47654.html 12 | 13 | #elif defined(__sun) //solaris 14 | 15 | #define HAVE_EVPORT //solaris evport 16 | 17 | #elif defined(__linux__) //linux 18 | 19 | #define HAVE_EPOLL //linux epoll 20 | 21 | #elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) //bsd 22 | 23 | #define __bsd__ 24 | 25 | #define HAVE_KQUEUE //bsd kqueue 26 | 27 | #else //other. 28 | 29 | #endif 30 | 31 | #define HAVE_SELECT //default 32 | 33 | /** 34 | * The accept4 system call which exists from kernel 2.6.28 35 | * and from glibc 2.10 (both conditions must be satisfied). 36 | */ 37 | //#define HAVE_ACCEPT4 38 | 39 | //#define HAVE_IPV6 40 | 41 | #define HAVE_THREADS 42 | 43 | #define HAVE_OPENSSL 44 | 45 | #endif /* ES_CONFIG_H_ */ 46 | -------------------------------------------------------------------------------- /efc/es_main.h: -------------------------------------------------------------------------------- 1 | /* 2 | * es_main.h 3 | * 4 | * Created on: 2013-8-16 5 | * Author: cxxjava@163.com 6 | */ 7 | 8 | #ifndef ES_MAIN_H_ 9 | #define ES_MAIN_H_ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif /* __cplusplus */ 14 | 15 | #ifdef __MAIN__ 16 | #define MAIN_IMPL(name) int main(int argc, const char **argv) 17 | #else //! 18 | #define MAIN_IMPL(name) \ 19 | int run_main_##name(int argc, const char** argv); \ 20 | int run_main_##name(int argc, const char** argv) 21 | 22 | #define MAIN_CALL(name) \ 23 | extern int run_main_##name(int argc, const char** argv); \ 24 | run_main_##name(argc, argv) 25 | #endif //!__MAIN__ 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif /* ES_MAIN_H_ */ 32 | -------------------------------------------------------------------------------- /efc/inc/EAdler32.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * EADLER32.hh 3 | * 4 | * Created on: 2017-12-24 5 | * Author: cxxjava@163.com 6 | */ 7 | 8 | #ifndef EADLER32_HH_ 9 | #define EADLER32_HH_ 10 | 11 | #include "EObject.hh" 12 | #include "EChecksum.hh" 13 | 14 | namespace efc { 15 | 16 | /** 17 | * A class that can be used to compute the Adler-32 checksum of a data 18 | * stream. An Adler-32 checksum is almost as reliable as a CRC-32 but 19 | * can be computed much faster. 20 | * 21 | *
Passing a {@code null} argument to a method in this class will cause
22 | * a {@link NullPointerException} to be thrown.
23 | *
24 | * @see Checksum
25 | */
26 |
27 | class EAdler32: virtual public EChecksum {
28 | public:
29 | virtual ~EAdler32();
30 |
31 | /**
32 | * Creates a new Adler32 object.
33 | */
34 | EAdler32();
35 |
36 | /**
37 | * Updates the checksum with the specified byte (the low eight
38 | * bits of the argument b).
39 | *
40 | * @param b the byte to update the checksum with
41 | */
42 | void update(byte b);
43 |
44 | /**
45 | * Updates the checksum with the specified array of bytes.
46 | *
47 | * @param b the byte array to update the checksum with
48 | */
49 | void update(byte* b, int len);
50 |
51 | /**
52 | * Resets the checksum to initial value.
53 | */
54 | llong getValue();
55 |
56 | /**
57 | * Resets CRC-32 to initial value.
58 | */
59 | void reset();
60 |
61 | private:
62 | ulong adler;// = 1;
63 | };
64 |
65 | } /* namespace efc */
66 | #endif /* EADLER32_HH_ */
67 |
--------------------------------------------------------------------------------
/efc/inc/EAlreadyBoundException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EAlreadyBoundException.h
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EALREADYBOUNDEXCEPTION_HH_
9 | #define EALREADYBOUNDEXCEPTION_HH_
10 |
11 | #include "EIllegalStateException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EALREADYBOUNDEXCEPTION EAlreadyBoundException(__FILE__, __LINE__, errno)
16 | #define EALREADYBOUNDEXCEPTIONS(msg) EAlreadyBoundException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * An Passing a {@code null} argument to a method in this class will cause
20 | * a {@link NullPointerException} to be thrown.
21 | *
22 | * @see Checksum
23 | */
24 |
25 | class ECRC32: virtual public EChecksum {
26 | public:
27 | virtual ~ECRC32();
28 |
29 | /**
30 | * Creates a new CRC32 object.
31 | */
32 | ECRC32();
33 |
34 | /**
35 | * Updates CRC-32 with specified byte.
36 | */
37 | void update(byte b);
38 |
39 | /**
40 | * Updates CRC-32 with specified array of bytes.
41 | */
42 | void update(byte* b, int len);
43 |
44 | /**
45 | * Returns CRC-32 value.
46 | */
47 | llong getValue();
48 |
49 | /**
50 | * Resets CRC-32 to initial value.
51 | */
52 | void reset();
53 |
54 | private:
55 | es_uint32_t _crc;
56 | };
57 |
58 | } /* namespace efc */
59 | #endif /* ECRC32_HH_ */
60 |
--------------------------------------------------------------------------------
/efc/inc/EChecksum.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EChecksum.hh
3 | *
4 | * Created on: 2013-7-24
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ECHECKSUM_HH_
9 | #define ECHECKSUM_HH_
10 |
11 | #include "EBase.hh"
12 |
13 | namespace efc {
14 |
15 | /**
16 | * An interface representing a data checksum.
17 | *
18 | * @version 1.17, 11/17/05
19 | */
20 | interface EChecksum : virtual public EObject {
21 | virtual ~EChecksum() {
22 | }
23 |
24 | /**
25 | * Updates the current checksum with the specified byte.
26 | *
27 | * @param b the byte to update the checksum with
28 | */
29 | virtual void update(byte b) = 0;
30 |
31 | /**
32 | * Updates the current checksum with the specified array of bytes.
33 | * @param b the byte array to update the checksum with
34 | * @param off the start offset of the data
35 | * @param len the number of bytes to use for the update
36 | */
37 | virtual void update(byte* b, int len) = 0;
38 |
39 | /**
40 | * Returns the current checksum value.
41 | * @return the current checksum value
42 | */
43 | virtual llong getValue() = 0;
44 |
45 | /**
46 | * Resets the checksum to its initial value.
47 | */
48 | virtual void reset() = 0;
49 | };
50 |
51 | } /* namespace efc */
52 | #endif /* ECHECKSUM_HH_ */
53 |
--------------------------------------------------------------------------------
/efc/inc/EClassCastException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EClassCastException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ECLASSCASTEXCEPTION_H_
9 | #define ECLASSCASTEXCEPTION_H_
10 |
11 | #include "ERuntimeException.hh"
12 |
13 | namespace efc {
14 |
15 | #define ECLASSCASTEXCEPTION EClassCastException(__FILE__, __LINE__, errno)
16 | #define ECLASSCASTEXCEPTIONS(msg) EClassCastException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Thrown to indicate that the code has attempted to cast an object
20 | * to a subclass of which it is not an instance. For example, the
21 | * following code generates a As noted in {@link AutoCloseable#close()}, cases where the
31 | * close may fail require careful attention. It is strongly advised
32 | * to relinquish the underlying resources and to internally
33 | * mark the {@code Closeable} as closed, prior to throwing
34 | * the {@code IOException}.
35 | *
36 | * @throws IOException if an I/O error occurs
37 | */
38 | virtual void close() THROWS(IOException) = 0;
39 | };
40 |
41 | } /* namespace efc */
42 | #endif /* ECloseable_HH_ */
43 |
44 |
--------------------------------------------------------------------------------
/efc/inc/EConnectException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EConnectException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EConnectException_H_
9 | #define EConnectException_H_
10 |
11 | #include "ESocketException.hh"
12 |
13 | namespace efc {
14 |
15 | #define ECONNECTEXCEPTION EConnectException(__FILE__, __LINE__, errno)
16 | #define ECONNECTEXCEPTIONS(msg) EConnectException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Signals that an error occurred while attempting to connect a
20 | * socket to a remote address and port. Typically, the connection
21 | * was refused remotely (e.g., no process is listening on the
22 | * remote address/port).
23 | *
24 | * @since JDK1.1
25 | */
26 |
27 | class EConnectException: public ESocketException {
28 | public:
29 | /**
30 | * Constructs an
22 | * This exception is mainly used by data input streams to signal end of
23 | * stream. Note that many other input operations return a special value on
24 | * end of stream rather than throwing an exception.
25 | *
26 | *
27 | * @see java.io.DataInputStream
28 | * @see java.io.IOException
29 | * @since JDK1.0
30 | */
31 |
32 | class EEOFException: public EIOException {
33 | public:
34 | /**
35 | * Constructs an
17 | * The root class from which all event state objects shall be derived.
18 | *
19 | * All Events are constructed with a reference to the object, the "source",
20 | * that is logically deemed to be the object upon which the Event in question
21 | * initially occurred upon.
22 | *
23 | * @since JDK1.1
24 | */
25 |
26 | class EEventObject: public EObject {
27 | public:
28 | /**
29 | * Constructs a prototypical Event.
30 | *
31 | * @param source The object on which the Event initially occurred.
32 | * @exception IllegalArgumentException if source is null.
33 | */
34 | EEventObject(EObject* source);
35 |
36 | /**
37 | * The object on which the Event initially occurred.
38 | *
39 | * @return The object on which the Event initially occurred.
40 | */
41 | EObject* getSource();
42 |
43 | /**
44 | * Returns a String representation of this EventObject.
45 | *
46 | * @return A a String representation of this EventObject.
47 | */
48 | virtual EString toString();
49 |
50 | protected:
51 | /**
52 | * The object on which the Event initially occurred.
53 | */
54 | EObject* source;
55 | };
56 |
57 | } /* namespace efc */
58 | #endif /* EEVENTOBJECT_HH_ */
59 |
--------------------------------------------------------------------------------
/efc/inc/EFileFilter.hh:
--------------------------------------------------------------------------------
1 | #ifndef __EFILEFILTER_HH__
2 | #define __EFILEFILTER_HH__
3 |
4 | #include "EBase.hh"
5 |
6 | namespace efc {
7 |
8 | class EFile;
9 |
10 | /**
11 | * A filter for abstract pathnames.
12 | *
13 | * Instances of this interface may be passed to the This exception will be thrown by the {@link FileInputStream}, {@link
23 | * FileOutputStream}, and {@link RandomAccessFile} constructors when a file
24 | * with the specified pathname does not exist. It will also be thrown by these
25 | * constructors if the file does exist but for some reason is inaccessible, for
26 | * example when an attempt is made to open a read-only file for writing.
27 | */
28 |
29 | class EFileNotFoundException: public EIOException {
30 | public:
31 | /**
32 | * Constructs an
22 | * Applications can subclass this class to indicate similar exceptions.
23 | */
24 |
25 | class EIndexOutOfBoundsException: public EException {
26 | public:
27 | /**
28 | * Constructs an This method is invoked only by Java code; when the garbage collector
49 | * clears references it does so directly, without invoking this method.
50 | */
51 | void clear() {
52 | referent.reset();
53 | }
54 |
55 | private:
56 | sp It is recommended practice to always immediately
21 | * follow a call to {@code lock} with a {@code try} block, most
22 | * typically in a before/after construction such as:
23 | *
24 | * The Callable interface is similar to {@link
26 | * java.lang.Runnable}, in that both are designed for classes whose
27 | * instances are potentially executed by another thread. A
28 | * Runnable, however, does not return a result and cannot
29 | * throw a checked exception.
30 | *
31 | * The {@link Executors} class contains utility methods to
32 | * convert from other common forms to Callable classes.
33 | *
34 | * @see Executor
35 | * @since 1.5
36 | * @param In the absence of other alternatives, the method may throw
35 | * an unchecked {@link RejectedExecutionException}, which will be
36 | * propagated to the caller of {@code execute}.
37 | *
38 | * @param r the runnable task requested to be executed
39 | * @param executor the executor attempting to execute this task
40 | * @throws RejectedExecutionException if there is no remedy
41 | */
42 | virtual void rejectedExecution(sp
21 | * The simplest implementation of this interface is just:
22 | * AlreadyBoundException
is thrown if an attempt
20 | * is made to bind an object in the registry to a name that already
21 | * has an associated binding.
22 | *
23 | * @since JDK1.1
24 | * @see java.rmi.Naming#bind(String, java.rmi.Remote)
25 | * @see java.rmi.registry.Registry#bind(String, java.rmi.Remote)
26 | */
27 |
28 | class EAlreadyBoundException: public EIllegalStateException {
29 | public:
30 | /**
31 | * Constructs an EAlreadyBoundException
with no
32 | * detail message.
33 | *
34 | * @param _file_ __FILE__
35 | * @param _line_ __LINE__
36 | * @param errn errno
37 | */
38 | EAlreadyBoundException(const char *_file_, int _line_, int errn = 0) :
39 | EIllegalStateException(_file_, _line_, errn) {
40 | }
41 |
42 | /**
43 | * Constructs an EAlreadyBoundException
with the
44 | * specified detail message.
45 | *
46 | * @param _file_ __FILE__.
47 | * @param _line_ __LINE__.
48 | * @param s the detail message.
49 | */
50 | EAlreadyBoundException(const char *_file_, int _line_, const char *s) :
51 | EIllegalStateException(_file_, _line_, s) {
52 | }
53 | };
54 |
55 | } /* namespace efc */
56 | #endif /* EALREADYBOUNDEXCEPTION_HH_ */
57 |
--------------------------------------------------------------------------------
/efc/inc/EAlreadyConnectedException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EAlreadyConnectedException.hh
3 | *
4 | * Created on: 2013-12-18
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EALREADYCONNECTEDEXCEPTION_HH_
9 | #define EALREADYCONNECTEDEXCEPTION_HH_
10 |
11 | #include "EIllegalStateException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EALREADYCONNECTEDEXCEPTION EAlreadyConnectedException(__FILE__, __LINE__, errno)
16 | #define EALREADYCONNECTEDEXCEPTIONS(msg) EAlreadyConnectedException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Unchecked exception thrown when an attempt is made to connect a {@link
20 | * SocketChannel} that is already connected.
21 | */
22 |
23 | class EAlreadyConnectedException : public EIllegalStateException {
24 | public:
25 | /**
26 | * Constructs an EAlreadyConnectedException
with no
27 | * detail message.
28 | *
29 | * @param _file_ __FILE__
30 | * @param _line_ __LINE__
31 | * @param errn errno
32 | */
33 | EAlreadyConnectedException(const char *_file_, int _line_, int errn = 0) :
34 | EIllegalStateException(_file_, _line_, errn) {
35 | }
36 |
37 | /**
38 | * Constructs an EAlreadyConnectedException
with the
39 | * specified detail message.
40 | *
41 | * @param _file_ __FILE__.
42 | * @param _line_ __LINE__.
43 | * @param s the detail message.
44 | */
45 | EAlreadyConnectedException(const char *_file_,
46 | int _line_, const char *s) :
47 | EIllegalStateException(_file_, _line_, s) {
48 | }
49 | };
50 |
51 | } /* namespace efc */
52 | #endif /* EALREADYCONNECTEDEXCEPTION_HH_ */
53 |
--------------------------------------------------------------------------------
/efc/inc/EArithmeticException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EArithmeticException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EARITHMETICEXCEPTION_H_
9 | #define EARITHMETICEXCEPTION_H_
10 |
11 | #include "ERuntimeException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EARITHMETICEXCEPTION EArithmeticException(__FILE__, __LINE__, errno)
16 | #define EARITHMETICEXCEPTIONS(msg) EArithmeticException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Thrown when an exceptional arithmetic condition has occurred. For
20 | * example, an integer "divide by zero" throws an
21 | * instance of this class.
22 | *
23 | * {@code ArithmeticException} objects may be constructed by the
24 | * virtual machine as if {@linkplain Throwable#Throwable(String,
25 | * Throwable, boolean, boolean) suppression were disabled and/or the
26 | * stack trace was not writable}.
27 | *
28 | * @since JDK1.0
29 | */
30 |
31 | class EArithmeticException: public ERuntimeException {
32 | public:
33 | /**
34 | * Constructs an EArithmeticException
with no
35 | * detail message.
36 | *
37 | * @param _file_ __FILE__
38 | * @param _line_ __LINE__
39 | * @param errn errno
40 | */
41 | EArithmeticException(const char *_file_, int _line_, int errn = 0) :
42 | ERuntimeException(_file_, _line_, errn) {
43 | }
44 |
45 | /**
46 | * Constructs an EArithmeticException
with the
47 | * specified detail message.
48 | *
49 | * @param _file_ __FILE__.
50 | * @param _line_ __LINE__.
51 | * @param s the detail message.
52 | */
53 | EArithmeticException(const char *_file_,
54 | int _line_, const char *s) :
55 | ERuntimeException(_file_, _line_, s) {
56 | }
57 | };
58 |
59 | } /* namespace efc */
60 | #endif /* EARITHMETICEXCEPTION_H_ */
61 |
--------------------------------------------------------------------------------
/efc/inc/EArrayIndexOutOfBoundsException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EArrayIndexOutOfBoundsException.hh
3 | *
4 | * Created on: 2018-1-1
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EARRAYINDEXOUTOFBOUNDSEXCEPTION_HH_
9 | #define EARRAYINDEXOUTOFBOUNDSEXCEPTION_HH_
10 |
11 | #include "EIndexOutOfBoundsException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EARRAYINDEXOUTOFBOUNDSEXCEPTION EArrayIndexOutOfBoundsException(__FILE__, __LINE__, errno)
16 | #define EARRAYINDEXOUTOFBOUNDSEXCEPTIONS(msg) EArrayIndexOutOfBoundsException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Thrown to indicate that an array has been accessed with an
20 | * illegal index. The index is either negative or greater than or
21 | * equal to the size of the array.
22 | *
23 | * @since JDK1.0
24 | */
25 |
26 | class EArrayIndexOutOfBoundsException: public EIndexOutOfBoundsException {
27 | public:
28 | /**
29 | * Constructs a new ArrayIndexOutOfBoundsException
30 | * class with an argument indicating the illegal index.
31 | *
32 | * @param _file_ __FILE__.
33 | * @param _line_ __LINE__.
34 | * @param index the illegal index.
35 | */
36 | EArrayIndexOutOfBoundsException(const char *_file_, int _line_, int index) :
37 | EIndexOutOfBoundsException(_file_, _line_, (EString("Array index out of range: ") + index).c_str()) {
38 | }
39 |
40 | /**
41 | * Constructs an EArrayIndexOutOfBoundsException
with the
42 | * specified detail message.
43 | *
44 | * @param _file_ __FILE__.
45 | * @param _line_ __LINE__.
46 | * @param s the detail message.
47 | */
48 | EArrayIndexOutOfBoundsException(const char *_file_, int _line_, const char *s) :
49 | EIndexOutOfBoundsException(_file_, _line_, s) {
50 | }
51 | };
52 |
53 | } /* namespace efc */
54 | #endif /* EARRAYINDEXOUTOFBOUNDSEXCEPTION_HH_ */
55 |
--------------------------------------------------------------------------------
/efc/inc/EBase64.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EBase64.hh
3 | *
4 | * Created on: 2013-7-17
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EBASE64_HH_
9 | #define EBASE64_HH_
10 |
11 | #include "EA.hh"
12 | #include "EByteBuffer.hh"
13 | #include "EIllegalArgumentException.hh"
14 |
15 | namespace efc {
16 |
17 | class EBase64 {
18 | public:
19 | /**
20 | * Translates the specified byte array into a Base64 string as per
21 | * Preferences.put(byte[]).
22 | */
23 | static EString byteArrayToBase64(byte* a, int len);
24 | static EString encodeBase64(byte* a, int len);
25 |
26 | /**
27 | * Translates the specified Base64 string (as per Preferences.get(byte[]))
28 | * into a byte array.
29 | *
30 | * @throw IllegalArgumentException if s is not a valid Base64
31 | * string.
32 | */
33 | static void base64ToByteArray(EByteBuffer *out, const char* s) THROWS(EIllegalArgumentException);
34 | static EAEBindException
with no
30 | * detail message.
31 | *
32 | * @param _file_ __FILE__
33 | * @param _line_ __LINE__
34 | * @param errn errno
35 | */
36 | EBindException(const char *_file_, int _line_, int errn = 0) :
37 | ESocketException(_file_, _line_, errn) {
38 | }
39 |
40 | /**
41 | * Constructs an EBindException
with the
42 | * specified detail message.
43 | *
44 | * @param _file_ __FILE__.
45 | * @param _line_ __LINE__.
46 | * @param s the detail message.
47 | */
48 | EBindException(const char *_file_, int _line_, const char *s, int errn = 0) :
49 | ESocketException(_file_, _line_, s, errn) {
50 | }
51 | };
52 |
53 | } /* namespace efc */
54 | #endif /* EBindException_H_ */
55 |
--------------------------------------------------------------------------------
/efc/inc/EBsonParser.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EBsonParser.hh
3 | *
4 | * Created on: 2013-7-30
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EBSONPARSER_HH_
9 | #define EBSONPARSER_HH_
10 |
11 | #include "EBson.hh"
12 | #include "EInputStream.hh"
13 | #include "EDataFormatException.hh"
14 |
15 | namespace efc {
16 |
17 | class EBsonParser: public EObject {
18 | public:
19 | virtual ~EBsonParser();
20 |
21 | EBsonParser(EInputStream* is);
22 |
23 | // unsupported.
24 | EBsonParser(const EBsonParser& that);
25 | // unsupported.
26 | EBsonParser& operator= (const EBsonParser& that);
27 |
28 | boolean nextBson(EBson* bson) THROWS(EDataFormateException);
29 |
30 | virtual void parsing(es_bson_node_t* node) {};
31 |
32 | protected:
33 | EInputStream* _is;
34 | EBson* _bson;
35 |
36 | struct Stream {
37 | es_bson_stream_t stm;
38 | EBsonParser* self;
39 | } _es;
40 |
41 | static es_int32_t stream_read(void *s, void *buf, es_size_t *size);
42 | static void parsed_node(void *s, es_bson_t *bson, es_bson_node_t *node);
43 | };
44 |
45 | } /* namespace efc */
46 | #endif /* EBSONPARSER_HH_ */
47 |
--------------------------------------------------------------------------------
/efc/inc/ECRC32.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * ECRC32.hh
3 | *
4 | * Created on: 2013-7-24
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ECRC32_HH_
9 | #define ECRC32_HH_
10 |
11 | #include "EObject.hh"
12 | #include "EChecksum.hh"
13 |
14 | namespace efc {
15 |
16 | /**
17 | * A class that can be used to compute the CRC-32 of a data stream.
18 | *
19 | * ClassCastException
:
22 | *
26 | *
27 | * @since JDK1.0
28 | */
29 |
30 | class EClassCastException: public ERuntimeException {
31 | public:
32 | /**
33 | * Constructs an
23 | * Object x = new Integer(0);
24 | * System.out.println((String)x);
25 | *
EClassCastException
with no
34 | * detail message.
35 | *
36 | * @param _file_ __FILE__
37 | * @param _line_ __LINE__
38 | * @param errn errno
39 | */
40 | EClassCastException(const char *_file_, int _line_, int errn = 0) :
41 | ERuntimeException(_file_, _line_, errn) {
42 | }
43 |
44 | /**
45 | * Constructs an EClassCastException
with the
46 | * specified detail message.
47 | *
48 | * @param _file_ __FILE__.
49 | * @param _line_ __LINE__.
50 | * @param s the detail message.
51 | */
52 | EClassCastException(const char *_file_,
53 | int _line_, const char *s) :
54 | ERuntimeException(_file_, _line_, s) {
55 | }
56 | };
57 |
58 | } /* namespace efc */
59 | #endif /* ECLASSCASTEXCEPTION_H_ */
60 |
--------------------------------------------------------------------------------
/efc/inc/ECloseable.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * ECloseable.hh
3 | *
4 | * Created on: 2013-3-19
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ECloseable_HH_
9 | #define ECloseable_HH_
10 |
11 | #include "EIOException.hh"
12 |
13 | namespace efc {
14 |
15 | /**
16 | * A {@code Closeable} is a source or destination of data that can be closed.
17 | * The close method is invoked to release resources that the object is
18 | * holding (such as open files).
19 | *
20 | * @since 1.5
21 | */
22 | interface ECloseable : virtual public EObject {
23 | virtual ~ECloseable(){}
24 |
25 | /**
26 | * Closes this stream and releases any system resources associated
27 | * with it. If the stream is already closed then invoking this
28 | * method has no effect.
29 | *
30 | * EConnectException
with no
31 | * detail message.
32 | *
33 | * @param _file_ __FILE__
34 | * @param _line_ __LINE__
35 | * @param errn errno
36 | */
37 | EConnectException(const char *_file_, int _line_, int errn = 0) :
38 | ESocketException(_file_, _line_, errn) {
39 | }
40 |
41 | /**
42 | * Constructs an EConnectException
with the
43 | * specified detail message.
44 | *
45 | * @param _file_ __FILE__.
46 | * @param _line_ __LINE__.
47 | * @param s the detail message.
48 | */
49 | EConnectException(const char *_file_, int _line_, const char *s, int errn = 0) :
50 | ESocketException(_file_, _line_, s, errn) {
51 | }
52 | };
53 |
54 | } /* namespace efc */
55 | #endif /* EConnectException_H_ */
56 |
--------------------------------------------------------------------------------
/efc/inc/EDataFormatException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EDataFormatException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EDATAFORMATEXCEPTION_HH_
9 | #define EDATAFORMATEXCEPTION_HH_
10 |
11 | #include "EException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EDATAFORMATEXCEPTION EDataFormatException(__FILE__, __LINE__, errno)
16 | #define EDATAFORMATEXCEPTIONS(msg) EDataFormatException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Signals that a data format error has occurred.
20 | *
21 | * @version 1.14, 11/17/05
22 | */
23 |
24 | class EDataFormatException: public EException {
25 | public:
26 | /**
27 | * Constructs an EDataFormatException
with no
28 | * detail message.
29 | *
30 | * @param _file_ __FILE__
31 | * @param _line_ __LINE__
32 | * @param errn errno
33 | */
34 | EDataFormatException(const char *_file_, int _line_, int errn = 0) :
35 | EException(_file_, _line_, errn) {
36 | }
37 |
38 | /**
39 | * Constructs an EDataFormatException
with the
40 | * specified detail message.
41 | *
42 | * @param _file_ __FILE__.
43 | * @param _line_ __LINE__.
44 | * @param s the detail message.
45 | */
46 | EDataFormatException(const char *_file_,
47 | int _line_, const char *s) :
48 | EException(_file_, _line_, s) {
49 | }
50 | };
51 |
52 | } /* namespace efc */
53 | #endif /* EDATAFORMATEXCEPTION_HH_ */
54 |
--------------------------------------------------------------------------------
/efc/inc/EEOFException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EEOFException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EEOFEXCEPTION_HH_
9 | #define EEOFEXCEPTION_HH_
10 |
11 | #include "EIOException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EEOFEXCEPTION EEOFException(__FILE__, __LINE__, errno)
16 | #define EEOFEXCEPTIONS(msg) EEOFException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Signals that an end of file or end of stream has been reached
20 | * unexpectedly during input.
21 | * EEOFException
with no
36 | * detail message.
37 | *
38 | * @param _file_ __FILE__
39 | * @param _line_ __LINE__
40 | * @param errn errno
41 | */
42 | EEOFException(const char *_file_, int _line_, int errn = 0) :
43 | EIOException(_file_, _line_, errn) {
44 | }
45 |
46 | /**
47 | * Constructs an EEOFException
with the
48 | * specified detail message.
49 | *
50 | * @param _file_ __FILE__.
51 | * @param _line_ __LINE__.
52 | * @param s the detail message.
53 | */
54 | EEOFException(const char *_file_, int _line_, const char *s, int errn = 0) :
55 | EIOException(_file_, _line_, s, errn) {
56 | }
57 | };
58 |
59 | } /* namespace efc */
60 | #endif /* EEOFEXCEPTION_HH_ */
61 |
--------------------------------------------------------------------------------
/efc/inc/EEmptyStackException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EEmptyStackException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EEMPTYSTACKEXCEPTION_H_
9 | #define EEMPTYSTACKEXCEPTION_H_
10 |
11 | #include "ERuntimeException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EEMPTYSTACKEXCEPTION EEmptyStackException(__FILE__, __LINE__, errno)
16 | #define EEMPTYSTACKEXCEPTIONS(msg) EEmptyStackException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Thrown by methods in the Stack
class to indicate
20 | * that the stack is empty.
21 | *
22 | * @see java.util.Stack
23 | * @since JDK1.0
24 | */
25 |
26 | class EEmptyStackException: public ERuntimeException {
27 | public:
28 | /**
29 | * Constructs an EEmptyStackException
with no
30 | * detail message.
31 | *
32 | * @param _file_ __FILE__
33 | * @param _line_ __LINE__
34 | * @param errn errno
35 | */
36 | EEmptyStackException(const char *_file_, int _line_, int errn = 0) :
37 | ERuntimeException(_file_, _line_, errn) {
38 | }
39 |
40 | /**
41 | * Constructs an EEmptyStackException
with the
42 | * specified detail message.
43 | *
44 | * @param _file_ __FILE__.
45 | * @param _line_ __LINE__.
46 | * @param s the detail message.
47 | */
48 | EEmptyStackException(const char *_file_,
49 | int _line_, const char *s) :
50 | ERuntimeException(_file_, _line_, s) {
51 | }
52 | };
53 |
54 | } /* namespace efc */
55 | #endif /* EEMPTYSTACKEXCEPTION_H_ */
56 |
--------------------------------------------------------------------------------
/efc/inc/EEventListener.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EEventListener.hh
3 | *
4 | * Created on: 2015-2-6
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EEVENTLISTENER_HH_
9 | #define EEVENTLISTENER_HH_
10 |
11 | #include "EObject.hh"
12 |
13 | namespace efc {
14 |
15 | /**
16 | * A tagging interface that all event listener interfaces must extend.
17 | * @since JDK1.1
18 | */
19 | interface EEventListener : virtual public EObject {
20 | virtual ~EEventListener() {
21 | }
22 | };
23 |
24 | } /* namespace efc */
25 | #endif /* EEVENTLISTENER_HH_ */
26 |
--------------------------------------------------------------------------------
/efc/inc/EEventObject.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EEventObject.hh
3 | *
4 | * Created on: 2015-2-6
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EEVENTOBJECT_HH_
9 | #define EEVENTOBJECT_HH_
10 |
11 | #include "EString.hh"
12 |
13 | namespace efc {
14 |
15 | /**
16 | * {@link
14 | * File#listFiles(java.io.FileFilter) listFiles(FileFilter)}
method
15 | * of the {@link java.io.File}
class.
16 | *
17 | * @since 1.2
18 | */
19 |
20 | interface EFileFilter : virtual public EObject
21 | {
22 | virtual ~EFileFilter(){}
23 |
24 | /**
25 | * Tests whether or not the specified abstract pathname should be
26 | * included in a pathname list.
27 | *
28 | * @param pathname The abstract pathname to be tested
29 | * @return true
if and only if pathname
30 | * should be included
31 | */
32 | virtual boolean accept(EFile *pathname) = 0;
33 | };
34 |
35 | } /* namespace efc */
36 | #endif //!__EFILEFILTER_HH__
37 |
--------------------------------------------------------------------------------
/efc/inc/EFileNotFoundException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EFileNotFoundException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EFILENOTFOUNDEXCEPTION_H_
9 | #define EFILENOTFOUNDEXCEPTION_H_
10 |
11 | #include "EIOException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EFILENOTFOUNDEXCEPTION EFileNotFoundException(__FILE__, __LINE__, errno)
16 | #define EFILENOTFOUNDEXCEPTIONS(msg) EFileNotFoundException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Signals that an attempt to open the file denoted by a specified pathname
20 | * has failed.
21 | *
22 | * EFileNotFoundException
with no
33 | * detail message.
34 | *
35 | * @param _file_ __FILE__
36 | * @param _line_ __LINE__
37 | * @param errn errno
38 | */
39 | EFileNotFoundException(const char *_file_, int _line_, int errn = 0) :
40 | EIOException(_file_, _line_, errn) {
41 | }
42 |
43 | /**
44 | * Constructs an EFileNotFoundException
with the
45 | * specified detail message.
46 | *
47 | * @param _file_ __FILE__.
48 | * @param _line_ __LINE__.
49 | * @param s the detail message.
50 | */
51 | EFileNotFoundException(const char *_file_,
52 | int _line_, const char *s) :
53 | EIOException(_file_, _line_, s) {
54 | }
55 | };
56 |
57 | } /* namespace efc */
58 | #endif /* EFILENOTFOUNDEXCEPTION_H_ */
59 |
--------------------------------------------------------------------------------
/efc/inc/EFilenameFilter.hh:
--------------------------------------------------------------------------------
1 | #ifndef __EFILENAMEFILTER_HH__
2 | #define __EFILENAMEFILTER_HH__
3 |
4 | #include "EBase.hh"
5 |
6 | namespace efc {
7 |
8 | class EFile;
9 |
10 | /**
11 | * This interface has one method which is used for filtering filenames
12 | * returned in a directory listing. It is currently used by the
13 | * \c File::list() method.
14 | *
15 | * The method in this interface determines if a particular file should
16 | * or should not be included in the file listing.
17 | *
18 | * @class FilenameFilter
19 | * @version $Id: FilenameFilter.h,v 1.4 2003-09-13 08:46:07 florian Exp $
20 | */
21 |
22 | interface EFilenameFilter : virtual public EObject
23 | {
24 | virtual ~EFilenameFilter(){}
25 |
26 | /**
27 | * This method determines whether or not a given file should be included
28 | * in a directory listing.
29 | *
30 | * @param dir The \c File instance for the directory being read
31 | * @param name The name of the file to test
32 | *
33 | * @return \c true if the file should be included in the list,
34 | * \c false otherwise.
35 | */
36 | virtual boolean accept(EFile *dir, const char *name) = 0;
37 | };
38 |
39 | } /* namespace efc */
40 | #endif //!__EFILENAMEFILTER_HH__
41 |
--------------------------------------------------------------------------------
/efc/inc/EFlushable.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EFlushable.hh
3 | *
4 | * Created on: 2013-3-19
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EFlushable_HH_
9 | #define EFlushable_HH_
10 |
11 | #include "EIOException.hh"
12 |
13 | namespace efc {
14 |
15 | /**
16 | * A Flushable is a destination of data that can be flushed. The
17 | * flush method is invoked to write any buffered output to the underlying
18 | * stream.
19 | *
20 | * @since 1.5
21 | */
22 | interface EFlushable : virtual public EObject {
23 | virtual ~EFlushable(){}
24 |
25 | /**
26 | * Flushes this stream by writing any buffered output to the underlying
27 | * stream.
28 | *
29 | * @throws IOException If an I/O error occurs
30 | */
31 | virtual void flush() THROWS(IOException) = 0;
32 | };
33 |
34 | } /* namespace efc */
35 | #endif /* EFlushable_HH_ */
36 |
37 |
--------------------------------------------------------------------------------
/efc/inc/EIllegalBlockingModeException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EIllegalBlockingModeException.hh
3 | *
4 | * Created on: 2013-12-16
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EILLEGALBLOCKINGMODEEXCEPTION_HH_
9 | #define EILLEGALBLOCKINGMODEEXCEPTION_HH_
10 |
11 | #include "EIllegalStateException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EILLEGALBLOCKINGMODEEXCEPTION EIllegalBlockingModeException(__FILE__, __LINE__, errno)
16 | #define EILLEGALBLOCKINGMODEEXCEPTIONS(msg) EIllegalBlockingModeException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Unchecked exception thrown when a blocking-mode-specific operation
20 | * is invoked upon a channel in the incorrect blocking mode.
21 | *
22 | * @version 1.9, 01/11/19
23 | * @since 1.4
24 | */
25 |
26 | class EIllegalBlockingModeException: public EIllegalStateException {
27 | public:
28 | /**
29 | * Constructs an EIllegalBlockingModeException
with no
30 | * detail message.
31 | *
32 | * @param _file_ __FILE__
33 | * @param _line_ __LINE__
34 | * @param errn errno
35 | */
36 | EIllegalBlockingModeException(const char *_file_, int _line_, int errn = 0) :
37 | EIllegalStateException(_file_, _line_, errn) {
38 | }
39 |
40 | /**
41 | * Constructs an EIllegalBlockingModeException
with the
42 | * specified detail message.
43 | *
44 | * @param _file_ __FILE__.
45 | * @param _line_ __LINE__.
46 | * @param s the detail message.
47 | */
48 | EIllegalBlockingModeException(const char *_file_, int _line_,
49 | const char *s) :
50 | EIllegalStateException(_file_, _line_, s) {
51 | }
52 | };
53 |
54 | } /* namespace efc */
55 | #endif /* EILLEGALBLOCKINGMODEEXCEPTION_HH_ */
56 |
--------------------------------------------------------------------------------
/efc/inc/EIllegalThreadStateException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EIllegalThreadStateException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EILLEGALTHREADSTATEEXCEPTION_HH_
9 | #define EILLEGALTHREADSTATEEXCEPTION_HH_
10 |
11 | #include "EIllegalArgumentException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EILLEGALTHREADSTATEEXCEPTION EIllegalThreadStateException(__FILE__, __LINE__, errno)
16 | #define EILLEGALTHREADSTATEEXCEPTIONS(msg) EIllegalThreadStateException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Thrown to indicate that a thread is not in an appropriate state
20 | * for the requested operation. See, for example, the
21 | * suspend
and resume
methods in class
22 | * Thread
.
23 | *
24 | * @see java.lang.Thread#resume()
25 | * @see java.lang.Thread#suspend()
26 | * @since JDK1.0
27 | */
28 |
29 | class EIllegalThreadStateException: public EIllegalArgumentException {
30 | public:
31 | /**
32 | * Constructs an EIllegalThreadStateException
with no
33 | * detail message.
34 | *
35 | * @param _file_ __FILE__
36 | * @param _line_ __LINE__
37 | * @param errn errno
38 | */
39 | EIllegalThreadStateException(const char *_file_, int _line_, int errn = 0) :
40 | EIllegalArgumentException(_file_, _line_, errn) {
41 | }
42 |
43 | /**
44 | * Constructs an EIllegalThreadStateException
with the
45 | * specified detail message.
46 | *
47 | * @param _file_ __FILE__.
48 | * @param _line_ __LINE__.
49 | * @param s the detail message.
50 | */
51 | EIllegalThreadStateException(const char *_file_, int _line_, const char *s, int errn = 0) :
52 | EIllegalArgumentException(_file_, _line_, s, errn) {
53 | }
54 | };
55 |
56 | } /* namespace efc */
57 | #endif /* EILLEGALTHREADSTATEEXCEPTION_HH_ */
58 |
--------------------------------------------------------------------------------
/efc/inc/EIndexOutOfBoundsException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EIndexOutOfBoundsException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EINDEXOUTOFBOUNDSEXCEPTION_H_
9 | #define EINDEXOUTOFBOUNDSEXCEPTION_H_
10 |
11 | #include "EException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EINDEXOUTOFBOUNDSEXCEPTION EIndexOutOfBoundsException(__FILE__, __LINE__, errno)
16 | #define EINDEXOUTOFBOUNDSEXCEPTIONS(msg) EIndexOutOfBoundsException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Thrown to indicate that an index of some sort (such as to an array,
20 | * to a string, or to a vector) is out of range.
21 | * EIndexOutOfBoundsException
with no
29 | * detail message.
30 | *
31 | * @param _file_ __FILE__
32 | * @param _line_ __LINE__
33 | * @param errn errno
34 | */
35 | EIndexOutOfBoundsException(const char *_file_, int _line_, int errn = 0) :
36 | EException(_file_, _line_, errn) {
37 | }
38 |
39 | /**
40 | * Constructs an EIndexOutOfBoundsException
with the
41 | * specified detail message.
42 | *
43 | * @param _file_ __FILE__.
44 | * @param _line_ __LINE__.
45 | * @param s the detail message.
46 | */
47 | EIndexOutOfBoundsException(const char *_file_,
48 | int _line_, const char *s) :
49 | EException(_file_, _line_, s) {
50 | }
51 | };
52 |
53 | } /* namespace efc */
54 | #endif /* EINDEXOUTOFBOUNDSEXCEPTION_H_ */
55 |
--------------------------------------------------------------------------------
/efc/inc/EInterruptible.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EInterruptible.hh
3 | *
4 | * Created on: 2014-10-21
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EINTERRUPTIBLE_HH_
9 | #define EINTERRUPTIBLE_HH_
10 |
11 | #include "EThread.hh"
12 |
13 | namespace efc {
14 |
15 | interface EInterruptible {
16 |
17 | virtual ~EInterruptible(){}
18 |
19 | virtual void interrupt(EThread* t) = 0;
20 |
21 | };
22 |
23 | } /* namespace efc */
24 | #endif /* EINTERRUPTIBLE_HH_ */
25 |
--------------------------------------------------------------------------------
/efc/inc/EIterable.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EIterable.hh
3 | *
4 | * Created on: 2013-3-19
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EITERABLE_HH_
9 | #define EITERABLE_HH_
10 |
11 | #include "EIterator.hh"
12 |
13 | namespace efc {
14 |
15 | /**
16 | * Implementing this interface allows an object to be the target of
17 | * the "foreach" statement.
18 | *
19 | * @param EMalformedURLException
with no
30 | * detail message.
31 | *
32 | * @param _file_ __FILE__
33 | * @param _line_ __LINE__
34 | * @param errn errno
35 | */
36 | EMalformedURLException(const char *_file_, int _line_, int errn = 0) :
37 | EIOException(_file_, _line_, errn) {
38 | }
39 |
40 | /**
41 | * Constructs an EMalformedURLException
with the
42 | * specified detail message.
43 | *
44 | * @param _file_ __FILE__.
45 | * @param _line_ __LINE__.
46 | * @param s the detail message.
47 | */
48 | EMalformedURLException(const char *_file_, int _line_, const char *s, int errn = 0) :
49 | EIOException(_file_, _line_, s, errn) {
50 | }
51 | };
52 |
53 | } /* namespace efc */
54 | #endif /* EMALFORMEDURLEXCEPTION_H_ */
55 |
--------------------------------------------------------------------------------
/efc/inc/ENoConnectionPendingException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * ENoConnectionPendingException.hh
3 | *
4 | * Created on: 2013-12-18
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ENOCONNECTIONPENDINGEXCEPTION_HH_
9 | #define ENOCONNECTIONPENDINGEXCEPTION_HH_
10 |
11 | #include "EIllegalStateException.hh"
12 |
13 | namespace efc {
14 |
15 | #define ENOCONNECTIONPENDINGEXCEPTION ENoConnectionPendingException(__FILE__, __LINE__, errno)
16 | #define ENOCONNECTIONPENDINGEXCEPTIONS(msg) ENoConnectionPendingException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Unchecked exception thrown when an attempt is made to connect a {@link
20 | * SocketChannel} for which a non-blocking connection operation is already in
21 | * progress.
22 | */
23 |
24 | class ENoConnectionPendingException : public EIllegalStateException {
25 | public:
26 | /**
27 | * Constructs an ENoConnectionPendingException
with no
28 | * detail message.
29 | *
30 | * @param _file_ __FILE__
31 | * @param _line_ __LINE__
32 | * @param errn errno
33 | */
34 | ENoConnectionPendingException(const char *_file_, int _line_, int errn = 0) :
35 | EIllegalStateException(_file_, _line_, errn) {
36 | }
37 |
38 | /**
39 | * Constructs an ENoConnectionPendingException
with the
40 | * specified detail message.
41 | *
42 | * @param _file_ __FILE__.
43 | * @param _line_ __LINE__.
44 | * @param s the detail message.
45 | */
46 | ENoConnectionPendingException(const char *_file_,
47 | int _line_, const char *s) :
48 | EIllegalStateException(_file_, _line_, s) {
49 | }
50 | };
51 |
52 | } /* namespace efc */
53 | #endif /* ENOCONNECTIONPENDINGEXCEPTION_HH_ */
54 |
--------------------------------------------------------------------------------
/efc/inc/ENoRouteToHostException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * ENoRouteToHostException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ENoRouteToHostException_H_
9 | #define ENoRouteToHostException_H_
10 |
11 | #include "ESocketException.hh"
12 |
13 | namespace efc {
14 |
15 | #define ENOROUTETOHOSTEXCEPTION ENoRouteToHostException(__FILE__, __LINE__, errno)
16 | #define ENOROUTETOHOSTEXCEPTIONS(msg) ENoRouteToHostException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Signals that an error occurred while attempting to connect a
20 | * socket to a remote address and port. Typically, the remote
21 | * host cannot be reached because of an intervening firewall, or
22 | * if an intermediate router is down.
23 | *
24 | * @since JDK1.1
25 | */
26 |
27 | class ENoRouteToHostException: public ESocketException {
28 | public:
29 | /**
30 | * Constructs an ENoRouteToHostException
with no
31 | * detail message.
32 | *
33 | * @param _file_ __FILE__
34 | * @param _line_ __LINE__
35 | * @param errn errno
36 | */
37 | ENoRouteToHostException(const char *_file_, int _line_, int errn = 0) :
38 | ESocketException(_file_, _line_, errn) {
39 | }
40 |
41 | /**
42 | * Constructs an ENoRouteToHostException
with the
43 | * specified detail message.
44 | *
45 | * @param _file_ __FILE__.
46 | * @param _line_ __LINE__.
47 | * @param s the detail message.
48 | */
49 | ENoRouteToHostException(const char *_file_, int _line_, const char *s, int errn = 0) :
50 | ESocketException(_file_, _line_, s, errn) {
51 | }
52 | };
53 |
54 | } /* namespace efc */
55 | #endif /* ENoRouteToHostException_H_ */
56 |
--------------------------------------------------------------------------------
/efc/inc/ENoSuchElementException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * ENoSuchElementException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ENOSUCHELEMENTEXCEPTION_H_
9 | #define ENOSUCHELEMENTEXCEPTION_H_
10 |
11 | #include "ERuntimeException.hh"
12 |
13 | namespace efc {
14 |
15 | #define ENOSUCHELEMENTEXCEPTION ENoSuchElementException(__FILE__, __LINE__, errno)
16 | #define ENOSUCHELEMENTEXCEPTIONS(msg) ENoSuchElementException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Thrown by the nextElement
method of an
20 | * Enumeration
to indicate that there are no more
21 | * elements in the enumeration.
22 | *
23 | * @see java.util.Enumeration
24 | * @see java.util.Enumeration#nextElement()
25 | * @since JDK1.0
26 | */
27 |
28 | class ENoSuchElementException: public ERuntimeException {
29 | public:
30 | /**
31 | * Constructs an ENoSuchElementException
with no
32 | * detail message.
33 | *
34 | * @param _file_ __FILE__
35 | * @param _line_ __LINE__
36 | * @param errn errno
37 | */
38 | ENoSuchElementException(const char *_file_, int _line_, int errn = 0) :
39 | ERuntimeException(_file_, _line_, errn) {
40 | }
41 |
42 | /**
43 | * Constructs an ENoSuchElementException
with the
44 | * specified detail message.
45 | *
46 | * @param _file_ __FILE__.
47 | * @param _line_ __LINE__.
48 | * @param s the detail message.
49 | */
50 | ENoSuchElementException(const char *_file_,
51 | int _line_, const char *s) :
52 | ERuntimeException(_file_, _line_, s) {
53 | }
54 | };
55 |
56 | } /* namespace efc */
57 | #endif /* ENOSUCHELEMENTEXCEPTION_H_ */
58 |
--------------------------------------------------------------------------------
/efc/inc/ENotYetBoundException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * ENotYetBoundException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ENOTYETBOUNDEXCEPTION_HH_
9 | #define ENOTYETBOUNDEXCEPTION_HH_
10 |
11 | #include "EIllegalStateException.hh"
12 |
13 | namespace efc {
14 |
15 | #define ENOTYETBOUNDEXCEPTION ENotYetBoundException(__FILE__, __LINE__, errno)
16 | #define ENOTYETBOUNDEXCEPTIONS(msg) ENotYetBoundException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Unchecked exception thrown when an attempt is made to invoke an I/O
20 | * operation upon a server socket channel that is not yet bound.
21 | */
22 |
23 | class ENotYetBoundException: public EIllegalStateException {
24 | public:
25 | /**
26 | * Constructs an ENotYetBoundException
with no
27 | * detail message.
28 | *
29 | * @param _file_ __FILE__
30 | * @param _line_ __LINE__
31 | * @param errn errno
32 | */
33 | ENotYetBoundException(const char *_file_, int _line_, int errn = 0) :
34 | EIllegalStateException(_file_, _line_, errn) {
35 | }
36 |
37 | /**
38 | * Constructs an ENotYetBoundException
with the
39 | * specified detail message.
40 | *
41 | * @param _file_ __FILE__.
42 | * @param _line_ __LINE__.
43 | * @param s the detail message.
44 | */
45 | ENotYetBoundException(const char *_file_, int _line_, const char *s) :
46 | EIllegalStateException(_file_, _line_, s) {
47 | }
48 | };
49 |
50 | } /* namespace efc */
51 | #endif /* ENOTYETBOUNDEXCEPTION_HH_ */
52 |
--------------------------------------------------------------------------------
/efc/inc/ENotYetConnectedException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * ENotYetConnectedException.hh
3 | *
4 | * Created on: 2013-12-18
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ENOTYETCONNECTEDEXCEPTION_HH_
9 | #define ENOTYETCONNECTEDEXCEPTION_HH_
10 |
11 | #include "EIllegalStateException.hh"
12 |
13 | namespace efc {
14 |
15 | #define ENOTYETCONNECTEDEXCEPTION ENotYetConnectedException(__FILE__, __LINE__, errno)
16 | #define ENOTYETCONNECTEDEXCEPTIONS(msg) ENotYetConnectedException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Unchecked exception thrown when an attempt is made to invoke an I/O
20 | * operation upon a socket channel that is not yet connected.
21 | */
22 |
23 | class ENotYetConnectedException : public EIllegalStateException {
24 | public:
25 | /**
26 | * Constructs an ENotYetConnectedException
with no
27 | * detail message.
28 | *
29 | * @param _file_ __FILE__
30 | * @param _line_ __LINE__
31 | * @param errn errno
32 | */
33 | ENotYetConnectedException(const char *_file_, int _line_, int errn = 0) :
34 | EIllegalStateException(_file_, _line_, errn) {
35 | }
36 |
37 | /**
38 | * Constructs an ENotYetConnectedException
with the
39 | * specified detail message.
40 | *
41 | * @param _file_ __FILE__.
42 | * @param _line_ __LINE__.
43 | * @param s the detail message.
44 | */
45 | ENotYetConnectedException(const char *_file_,
46 | int _line_, const char *s) :
47 | EIllegalStateException(_file_, _line_, s) {
48 | }
49 | };
50 |
51 | } /* namespace efc */
52 | #endif /* ENOTYETCONNECTEDEXCEPTION_HH_ */
53 |
--------------------------------------------------------------------------------
/efc/inc/ENumberFormatException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * ENumberFormatException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ENUMBERFORMATEXCEPTION_H_
9 | #define ENUMBERFORMATEXCEPTION_H_
10 |
11 | #include "EException.hh"
12 |
13 | namespace efc {
14 |
15 | #define ENUMBERFORMATEXCEPTION ENumberFormatException(__FILE__, __LINE__, errno)
16 | #define ENUMBERFORMATEXCEPTIONS(msg) ENumberFormatException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Thrown to indicate that the application has attempted to convert
20 | * a string to one of the numeric types, but that the string does not
21 | * have the appropriate format.
22 | */
23 |
24 | class ENumberFormatException: public EException {
25 | public:
26 | /**
27 | * Constructs an ENumberFormatException
with no
28 | * detail message.
29 | *
30 | * @param _file_ __FILE__
31 | * @param _line_ __LINE__
32 | * @param errn errno
33 | */
34 | ENumberFormatException(const char *_file_, int _line_, int errn = 0) :
35 | EException(_file_, _line_, errn) {
36 | }
37 |
38 | /**
39 | * Constructs an IllegalArgumentException
with the
40 | * specified detail message.
41 | *
42 | * @param _file_ __FILE__.
43 | * @param _line_ __LINE__.
44 | * @param s the detail message.
45 | */
46 | ENumberFormatException(const char *_file_, int _line_,
47 | const char *s) :
48 | EException(_file_, _line_, s) {
49 | }
50 | };
51 |
52 | } /* namespace efc */
53 | #endif /* ENUMBERFORMATEXCEPTION_H_ */
54 |
--------------------------------------------------------------------------------
/efc/inc/EOS.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EOS.hh
3 | *
4 | * Created on: 2015-2-11
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EOS_HH_
9 | #define EOS_HH_
10 |
11 | #include "EBase.hh"
12 |
13 | namespace efc {
14 |
15 | class EOS {
16 | public:
17 | DECLARE_STATIC_INITZZ;
18 |
19 | public:
20 | // Interface for detecting multiprocessor system
21 | static inline boolean is_MP() {
22 | ES_ASSERT(_processor_count > 0);
23 | return _processor_count > 1;
24 | }
25 | static ullong available_memory();
26 | static ullong physical_memory();
27 |
28 | // number of CPUs
29 | static int processor_count() {
30 | return _processor_count;
31 | }
32 |
33 | // size of Page.
34 | static int page_size(void) {
35 | return _page_size;
36 | }
37 |
38 | // Returns the number of CPUs this process is currently allowed to run on.
39 | // Note that on some OSes this can change dynamically.
40 | static int active_processor_count();
41 |
42 | // Bind processes to processors.
43 | // This is a two step procedure:
44 | // first you generate a distribution of processes to processors,
45 | // then you bind processes according to that distribution.
46 | // Compute a distribution for number of processes to processors.
47 | // Stores the processor id's into the distribution array argument.
48 | // Returns true if it worked, false if it didn't.
49 | static boolean distribute_processes(uint length, uint* distribution);
50 | // Binds the current process to a processor.
51 | // Returns true if it worked, false if it didn't.
52 | static boolean bind_to_processor(uint processor_id);
53 |
54 | protected:
55 | static int _processor_count; // number of processors
56 | static int _page_size; // size of page
57 | static ullong _physical_memory; // number of memorys
58 | };
59 |
60 | } /* namespace efc */
61 | #endif /* EOS_HH_ */
62 |
--------------------------------------------------------------------------------
/efc/inc/EObserver.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EObserver.hh
3 | *
4 | * Created on: 2013-3-19
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EOBSERVER_HH_
9 | #define EOBSERVER_HH_
10 |
11 | #include "EObject.hh"
12 |
13 | namespace efc {
14 |
15 | class EObservable;
16 |
17 | /**
18 | * A class can implement the Observer
interface when it
19 | * wants to be informed of changes in observable objects.
20 | *
21 | * @see java.util.Observable
22 | * @since JDK1.0
23 | */
24 |
25 | interface EObserver : virtual public EObject
26 | {
27 | virtual ~EObserver(){}
28 |
29 | /**
30 | * This method is called whenever the observed object is changed. An
31 | * application calls an Observable object's
32 | * notifyObservers
method to have all the object's
33 | * observers notified of the change.
34 | *
35 | * @param o the observable object.
36 | * @param arg an argument passed to the notifyObservers
37 | * method.
38 | */
39 | virtual void update(EObservable* o, void* arg) = 0;
40 | };
41 |
42 | } /* namespace efc */
43 | #endif /* EOBSERVER_HH_ */
44 |
--------------------------------------------------------------------------------
/efc/inc/EOutOfMemoryError.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EOutOfMemoryError.hh
3 | *
4 | * Created on: 2014-2-16
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EOUTOFMEMORYERROR_HH_
9 | #define EOUTOFMEMORYERROR_HH_
10 |
11 | #include "EThrowable.hh"
12 |
13 | namespace efc {
14 |
15 | #define EOUTOFMEMORYERROR EOutOfMemoryError(__FILE__, __LINE__, errno)
16 | #define EOUTOFMEMORYERRORS(msg) EOutOfMemoryError(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * The class EOutOfMemoryError
and its subclasses are a form of
20 | * Throwable
that indicates conditions that a reasonable
21 | * application out of memory.
22 | */
23 |
24 | class EOutOfMemoryError : public EThrowable {
25 | public:
26 | /**
27 | * Constructs an EOutOfMemoryError
with no specified detail message.
28 | *
29 | * @param _file_ __FILE__
30 | * @param _line_ __LINE__
31 | * @param errn errno
32 | */
33 | EOutOfMemoryError(const char *_file_, int _line_, int errn = 0) :
34 | EThrowable(_file_, _line_, errn) {
35 | }
36 |
37 | /**
38 | * Constructs an EOutOfMemoryError
with the specified detail message.
39 | *
40 | * @param _file_ __FILE__
41 | * @param _line_ __LINE__
42 | * @param s the detail message.
43 | */
44 | EOutOfMemoryError(const char *_file_, int _line_, const char *s, int errn = 0) :
45 | EThrowable(_file_, _line_, s, errn) {
46 | }
47 | };
48 |
49 | } /* namespace efc */
50 | #endif /* EOUTOFMEMORYERROR_HH_ */
51 |
--------------------------------------------------------------------------------
/efc/inc/EPortUnreachableException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EPortUnreachableException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EPORTUNREACHABLEEXCEPTION_H_
9 | #define EPORTUNREACHABLEEXCEPTION_H_
10 |
11 | #include "ESocketException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EPORTUNREACHABLEEXCEPTION EPortUnreachableException(__FILE__, __LINE__, errno)
16 | #define EPORTUNREACHABLEEXCEPTIONS(msg) EPortUnreachableException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Signals that an ICMP Port Unreachable message has been
20 | * received on a connected datagram.
21 | *
22 | * @since 1.4
23 | */
24 |
25 | class EPortUnreachableException: public ESocketException {
26 | public:
27 | /**
28 | * Constructs an EPortUnreachableException
with no
29 | * detail message.
30 | *
31 | * @param _file_ __FILE__
32 | * @param _line_ __LINE__
33 | * @param errn errno
34 | */
35 | EPortUnreachableException(const char *_file_, int _line_, int errn = 0) :
36 | ESocketException(_file_, _line_, errn) {
37 | }
38 |
39 | /**
40 | * Constructs an EPortUnreachableException
with the
41 | * specified detail message.
42 | *
43 | * @param _file_ __FILE__.
44 | * @param _line_ __LINE__.
45 | * @param s the detail message.
46 | */
47 | EPortUnreachableException(const char *_file_, int _line_, const char *s, int errn = 0) :
48 | ESocketException(_file_, _line_, s, errn) {
49 | }
50 | };
51 |
52 | } /* namespace efc */
53 | #endif /* EPORTUNREACHABLEEXCEPTION_H_ */
54 |
--------------------------------------------------------------------------------
/efc/inc/EProtocolException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EProtocolException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EPROTOCOLEXCEPTION_HH_
9 | #define EPROTOCOLEXCEPTION_HH_
10 |
11 | #include "EIOException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EPROTOCOLEXCEPTION EProtocolException(__FILE__, __LINE__, errno)
16 | #define EPROTOCOLEXCEPTIONS(msg) EProtocolException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Thrown to indicate that there is an error in the underlying
20 | * protocol, such as a TCP error.
21 | *
22 | * @since JDK1.0
23 | */
24 |
25 | class EProtocolException: public EIOException {
26 | public:
27 | /**
28 | * Constructs an EProtocolException
with no
29 | * detail message.
30 | *
31 | * @param _file_ __FILE__
32 | * @param _line_ __LINE__
33 | * @param errn errno
34 | */
35 | EProtocolException(const char *_file_, int _line_, int errn = 0) :
36 | EIOException(_file_, _line_, errn) {
37 | }
38 |
39 | /**
40 | * Constructs an EProtocolException
with the
41 | * specified detail message.
42 | *
43 | * @param _file_ __FILE__.
44 | * @param _line_ __LINE__.
45 | * @param s the detail message.
46 | */
47 | EProtocolException(const char *_file_, int _line_, const char *s, int errn = 0) :
48 | EIOException(_file_, _line_, s, errn) {
49 | }
50 | };
51 |
52 | } /* namespace efc */
53 | #endif /* EPROTOCOLEXCEPTION_HH_ */
54 |
--------------------------------------------------------------------------------
/efc/inc/EReference.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EReference.hh
3 | *
4 | * Created on: 2014-11-26
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EREFERENCE_HH_
9 | #define EREFERENCE_HH_
10 |
11 | #include "EObject.hh"
12 | #include "ESharedPtr.hh"
13 |
14 | namespace efc {
15 |
16 | /**
17 | * This class is for reference objects. This class defines the
18 | * operations common to all reference objects. Because reference objects are
19 | * implemented in close cooperation with the garbage collector, this class may
20 | * not be subclassed directly.
21 | *
22 | * @since 1.2
23 | */
24 | templatenull
.
36 | *
37 | * @return The object to which this reference refers, or
38 | * null
if this reference object has been cleared
39 | */
40 | sp-1
47 | * indicates that the object is not on the stack.
48 | */
49 | int search(EObject *o);
50 | };
51 |
52 | } /* namespace efc */
53 | #endif //!__ESimpleStack_H__
54 |
--------------------------------------------------------------------------------
/efc/inc/ESocketTimeoutException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * ESocketTimeoutException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ESOCKETTIMEOUTEXCEPTION_HH_
9 | #define ESOCKETTIMEOUTEXCEPTION_HH_
10 |
11 | #include "EInterruptedIOException.hh"
12 |
13 | namespace efc {
14 |
15 | #define ESOCKETTIMEOUTEXCEPTION ESocketTimeoutException(__FILE__, __LINE__, errno)
16 | #define ESOCKETTIMEOUTEXCEPTIONS(msg) ESocketTimeoutException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Signals that a timeout has occurred on a socket read or accept.
20 | *
21 | * @since 1.4
22 | */
23 |
24 | class ESocketTimeoutException: public EInterruptedIOException {
25 | public:
26 | /**
27 | * Constructs an ESocketTimeoutException
with no
28 | * detail message.
29 | *
30 | * @param _file_ __FILE__
31 | * @param _line_ __LINE__
32 | * @param errn errno
33 | */
34 | ESocketTimeoutException(const char *_file_, int _line_, int errn = 0) :
35 | EInterruptedIOException(_file_, _line_, errn) {
36 | }
37 |
38 | /**
39 | * Constructs an ESocketTimeoutException
with the
40 | * specified detail message.
41 | *
42 | * @param _file_ __FILE__.
43 | * @param _line_ __LINE__.
44 | * @param s the detail message.
45 | */
46 | ESocketTimeoutException(const char *_file_,
47 | int _line_, const char *s) :
48 | EInterruptedIOException(_file_, _line_, s) {
49 | }
50 | };
51 |
52 | } /* namespace efc */
53 | #endif /* ESOCKETTIMEOUTEXCEPTION_HH_ */
54 |
--------------------------------------------------------------------------------
/efc/inc/ESpinLock.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * ESpinLock.hh
3 | *
4 | * Created on: 2013-3-18
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ESpinLock_HH_
9 | #define ESpinLock_HH_
10 |
11 | #include "ELock.hh"
12 | #include "ETimeUnit.hh"
13 | #include "EUnsupportedOperationException.hh"
14 |
15 | namespace efc {
16 |
17 | /**
18 | * Spin Lock.
19 | *
20 | *
25 | * class X {
26 | * private final ReentrantLock lock = new ReentrantLock();
27 | * // ...
28 | *
29 | * public void m() {
30 | * lock.lock(); // block until condition holds
31 | * try {
32 | * // ... method body
33 | * } finally {
34 | * lock.unlock()
35 | * }
36 | * }
37 | * }
38 | *
39 | */
40 |
41 | class ESpinLock : virtual public ELock{
42 | public:
43 | ESpinLock();
44 | ~ESpinLock();
45 |
46 | void lock();
47 | void lockInterruptibly() THROWS(EInterruptedException);
48 | boolean tryLock();
49 | boolean tryLock(llong time, ETimeUnit* unit) THROWS(EInterruptedException);
50 | void unlock();
51 |
52 | ECondition* newCondition() {throw EUNSUPPORTEDOPERATIONEXCEPTION;}
53 |
54 | private:
55 | es_thread_spin_t *m_Spin;
56 | };
57 |
58 | } /* namespace efc */
59 | #endif /* ESpinLock_HH_ */
60 |
--------------------------------------------------------------------------------
/efc/inc/EThreadLocalStorage.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EThreadLocalStorage.hh
3 | *
4 | * Created on: 2014-1-27
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ETHREADLOCALSTORAGE_HH_
9 | #define ETHREADLOCALSTORAGE_HH_
10 |
11 | #include "EBase.hh"
12 |
13 | namespace efc {
14 |
15 | class EThreadLocalStorage {
16 | public:
17 | virtual ~EThreadLocalStorage();
18 |
19 | EThreadLocalStorage();
20 |
21 | // unsupported.
22 | EThreadLocalStorage(const EThreadLocalStorage& that);
23 | EThreadLocalStorage& operator= (const EThreadLocalStorage& that);
24 |
25 | /**
26 | * Returns the value in the current thread's copy of this
27 | * thread-local variable. If the variable has no value for the
28 | * current thread, it is first initialized to the value returned
29 | * by an invocation of the {@link #initialValue} method.
30 | *
31 | * @return the current thread's value of this thread-local
32 | */
33 | void* get();
34 |
35 | /**
36 | * Sets the current thread's copy of this thread-local variable
37 | * to the specified value. Most subclasses will have no need to
38 | * override this method, relying solely on the {@link #initialValue}
39 | * method to set the values of thread-locals.
40 | *
41 | * @param value the value to be stored in the current thread's copy of
42 | * this thread-local.
43 | */
44 | void set(void* value);
45 |
46 | private:
47 | long thread_key;
48 | };
49 |
50 | } /* namespace efc */
51 | #endif /* ETHREADLOCALSTORAGE_HH_ */
52 |
--------------------------------------------------------------------------------
/efc/inc/EThreadUnCInitException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EThreadUnCInitException.hh
3 | *
4 | * Created on: 2017-10-26
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ETHREADUNCINITEXCEPTION_H_
9 | #define ETHREADUNCINITEXCEPTION_H_
10 |
11 | #include "ERuntimeException.hh"
12 |
13 | namespace efc {
14 |
15 | #define ETHREADUNCINITEXCEPTION EThreadUnCInitException(__FILE__, __LINE__, errno)
16 | #define ETHREADUNCINITEXCEPTIONS(msg) EThreadUnCInitException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Thrown this exception when a native thread have not called EThread::c_init().
20 | */
21 |
22 | class EThreadUnCInitException: public ERuntimeException {
23 | public:
24 | /**
25 | * Constructs an EThreadUnCInitException
with no
26 | * detail message.
27 | *
28 | * @param _file_ __FILE__
29 | * @param _line_ __LINE__
30 | * @param errn errno
31 | */
32 | EThreadUnCInitException(const char *_file_, int _line_, int errn = 0) :
33 | ERuntimeException(_file_, _line_, errn) {
34 | }
35 |
36 | /**
37 | * Constructs an EThreadUnCInitException
with the
38 | * specified detail message.
39 | *
40 | * @param _file_ __FILE__.
41 | * @param _line_ __LINE__.
42 | * @param s the detail message.
43 | */
44 | EThreadUnCInitException(const char *_file_,
45 | int _line_, const char *s) :
46 | ERuntimeException(_file_, _line_, s) {
47 | }
48 | };
49 |
50 | } /* namespace efc */
51 | #endif /* ETHREADUNCINITEXCEPTION_H_ */
52 |
--------------------------------------------------------------------------------
/efc/inc/EToDoException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EToDoException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ETODOEXCEPTION_H_
9 | #define ETODOEXCEPTION_H_
10 |
11 | #include "EException.hh"
12 |
13 | namespace efc {
14 |
15 | #define ETODOEXCEPTION EToDoException(__FILE__, __LINE__, errno)
16 | #define ETODOEXCEPTIONS(msg) EToDoException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * EToDoException
means this need to do.
20 | */
21 |
22 | class EToDoException: public EException {
23 | public:
24 | /**
25 | * Constructs an EToDoException
with no
26 | * detail message.
27 | *
28 | * @param _file_ __FILE__
29 | * @param _line_ __LINE__
30 | * @param errn errno
31 | */
32 | EToDoException(const char *_file_, int _line_, int errn = 0) :
33 | EException(_file_, _line_, errn) {
34 | }
35 |
36 | /**
37 | * Constructs an EToDoException
with the
38 | * specified detail message.
39 | *
40 | * @param _file_ __FILE__.
41 | * @param _line_ __LINE__.
42 | * @param s the detail message.
43 | */
44 | EToDoException(const char *_file_, int _line_, const char *s, int errn = 0) :
45 | EException(_file_, _line_, s, errn) {
46 | }
47 | };
48 |
49 | } /* namespace efc */
50 | #endif /* ETODOEXCEPTION_H_ */
51 |
--------------------------------------------------------------------------------
/efc/inc/EURLString.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EURLString.hh
3 | *
4 | * Created on: 2013-3-16
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef __EURLString_H__
9 | #define __EURLString_H__
10 |
11 | #include "EString.hh"
12 |
13 | namespace efc {
14 |
15 | class EURLString : public EString
16 | {
17 | public:
18 | virtual ~EURLString(){}
19 |
20 | EURLString(const char* s);
21 |
22 | /**
23 | * Concat of a string.
24 | */
25 | EURLString& concat(const char* s, int len=-1);
26 |
27 | /**
28 | * Concat of a format string.
29 | */
30 | EURLString& fmtcat(const char* fmt, ...);
31 |
32 | /**
33 | *Concat of a encoded URL string.
34 | */
35 | EURLString& enccat(const char* s, int len=-1);
36 |
37 | /**
38 | * Concat of a decoded URL string.
39 | */
40 | EURLString& deccat(const char* s);
41 | };
42 |
43 | } /* namespace efc */
44 | #endif //!__EURLString_H__
45 |
--------------------------------------------------------------------------------
/efc/inc/EUnknownHostException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EUnknownHostException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EUNKNOWNHOSTEXCEPTION_HH_
9 | #define EUNKNOWNHOSTEXCEPTION_HH_
10 |
11 | #include "EIOException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EUNKNOWNHOSTEXCEPTION EUnknownHostException(__FILE__, __LINE__, errno)
16 | #define EUNKNOWNHOSTEXCEPTIONS(msg) EUnknownHostException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Thrown to indicate that the IP address of a host could not be determined.
20 | *
21 | * @since JDK1.0
22 | */
23 |
24 | class EUnknownHostException: public EIOException {
25 | public:
26 | /**
27 | * Constructs an EUnknownHostException
with no
28 | * detail message.
29 | *
30 | * @param _file_ __FILE__
31 | * @param _line_ __LINE__
32 | * @param errn errno
33 | */
34 | EUnknownHostException(const char *_file_, int _line_, int errn = 0) :
35 | EIOException(_file_, _line_, errn) {
36 | }
37 |
38 | /**
39 | * Constructs an EUnknownHostException
with the
40 | * specified detail message.
41 | *
42 | * @param _file_ __FILE__.
43 | * @param _line_ __LINE__.
44 | * @param s the detail message.
45 | */
46 | EUnknownHostException(const char *_file_,
47 | int _line_, const char *s) :
48 | EIOException(_file_, _line_, s) {
49 | }
50 | };
51 |
52 | } /* namespace efc */
53 | #endif /* EUNKNOWNHOSTEXCEPTION_HH_ */
54 |
--------------------------------------------------------------------------------
/efc/inc/EUnknownServiceException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EUnknownServiceException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EUNKNOWNSERVICEEXCEPTION_HH_
9 | #define EUNKNOWNSERVICEEXCEPTION_HH_
10 |
11 | #include "EIOException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EUNKNOWNSERVICEEXCEPTION EUnknownServiceException(__FILE__, __LINE__, errno)
16 | #define EUNKNOWNSERVICEEXCEPTIONS(msg) EUnknownServiceException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Thrown to indicate that an unknown service exception has
20 | * occurred. Either the MIME type returned by a URL connection does
21 | * not make sense, or the application is attempting to write to a
22 | * read-only URL connection.
23 | *
24 | * @since JDK1.0
25 | */
26 |
27 | class EUnknownServiceException: public EIOException {
28 | public:
29 | /**
30 | * Constructs an EUnknownServiceException
with no
31 | * detail message.
32 | *
33 | * @param _file_ __FILE__
34 | * @param _line_ __LINE__
35 | * @param errn errno
36 | */
37 | EUnknownServiceException(const char *_file_, int _line_, int errn = 0) :
38 | EIOException(_file_, _line_, errn) {
39 | }
40 |
41 | /**
42 | * Constructs an EUnknownServiceException
with the
43 | * specified detail message.
44 | *
45 | * @param _file_ __FILE__.
46 | * @param _line_ __LINE__.
47 | * @param s the detail message.
48 | */
49 | EUnknownServiceException(const char *_file_,
50 | int _line_, const char *s) :
51 | EIOException(_file_, _line_, s) {
52 | }
53 | };
54 |
55 | } /* namespace efc */
56 | #endif /* EUNKNOWNSERVICEEXCEPTION_HH_ */
57 |
--------------------------------------------------------------------------------
/efc/inc/EUnresolvedAddressException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EUnresolvedAddressException.h
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EUNRESOLVEDADDRESSEXCEPTION_HH_
9 | #define EUNRESOLVEDADDRESSEXCEPTION_HH_
10 |
11 | #include "EIllegalArgumentException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EUNRESOLVEDADDRESSEXCEPTION EUnresolvedAddressException(__FILE__, __LINE__, errno)
16 | #define EUNRESOLVEDADDRESSEXCEPTIONS(msg) EUnresolvedAddressException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Unchecked exception thrown when an attempt is made to invoke a network
20 | * operation upon an unresolved socket address.
21 | */
22 |
23 | class EUnresolvedAddressException: public EIllegalArgumentException {
24 | public:
25 | /**
26 | * Constructs an EUnresolvedAddressException
with no
27 | * detail message.
28 | *
29 | * @param _file_ __FILE__
30 | * @param _line_ __LINE__
31 | * @param errn errno
32 | */
33 | EUnresolvedAddressException(const char *_file_, int _line_, int errn = 0) :
34 | EIllegalArgumentException(_file_, _line_, errn) {
35 | }
36 |
37 | /**
38 | * Constructs an EUnresolvedAddressException
with the
39 | * specified detail message.
40 | *
41 | * @param _file_ __FILE__.
42 | * @param _line_ __LINE__.
43 | * @param s the detail message.
44 | */
45 | EUnresolvedAddressException(const char *_file_, int _line_, const char *s, int errn = 0) :
46 | EIllegalArgumentException(_file_, _line_, s, errn) {
47 | }
48 | };
49 |
50 | } /* namespace efc */
51 | #endif /* EUNRESOLVEDADDRESSEXCEPTION_HH_ */
52 |
--------------------------------------------------------------------------------
/efc/inc/EUnsupportedAddressTypeException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EUnsupportedAddressTypeException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EUNSUPPORTEDADDRESSTYPEEXCEPTION_HH_
9 | #define EUNSUPPORTEDADDRESSTYPEEXCEPTION_HH_
10 |
11 | #include "EIllegalArgumentException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EUNSUPPORTEDADDRESSTYPEEXCEPTION EUnsupportedAddressTypeException(__FILE__, __LINE__, errno)
16 | #define EUNSUPPORTEDADDRESSTYPEEXCEPTIONS(msg) EUnsupportedAddressTypeException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Unchecked exception thrown when an attempt is made to bind or connect
20 | * to a socket address of a type that is not supported.
21 | */
22 |
23 | class EUnsupportedAddressTypeException: public EIllegalArgumentException {
24 | public:
25 | /**
26 | * Constructs an EUnsupportedAddressTypeException
with no
27 | * detail message.
28 | *
29 | * @param _file_ __FILE__
30 | * @param _line_ __LINE__
31 | * @param errn errno
32 | */
33 | EUnsupportedAddressTypeException(const char *_file_, int _line_, int errn = 0) :
34 | EIllegalArgumentException(_file_, _line_, errn) {
35 | }
36 |
37 | /**
38 | * Constructs an EUnsupportedAddressTypeException
with the
39 | * specified detail message.
40 | *
41 | * @param _file_ __FILE__.
42 | * @param _line_ __LINE__.
43 | * @param s the detail message.
44 | */
45 | EUnsupportedAddressTypeException(const char *_file_, int _line_, const char *s, int errn = 0) :
46 | EIllegalArgumentException(_file_, _line_, s, errn) {
47 | }
48 | };
49 |
50 | } /* namespace efc */
51 | #endif /* EUNSUPPORTEDADDRESSTYPEEXCEPTION_HH_ */
52 |
--------------------------------------------------------------------------------
/efc/inc/EUnsupportedEncodingException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EUnsupportedEncodingException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EUNSUPPORTEDENCODINGEXCEPTION_H_
9 | #define EUNSUPPORTEDENCODINGEXCEPTION_H_
10 |
11 | #include "EIOException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EUNSUPPORTEDENCODINGEXCEPTION EUnsupportedEncodingException(__FILE__, __LINE__, errno)
16 | #define EUNSUPPORTEDENCODINGEXCEPTIONS(msg) EUnsupportedEncodingException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * The Character Encoding is not supported.
20 | *
21 | * @since JDK1.1
22 | */
23 |
24 | class EUnsupportedEncodingException: public EIOException {
25 | public:
26 | /**
27 | * Constructs an EUnsupportedEncodingException
with no
28 | * detail message.
29 | *
30 | * @param _file_ __FILE__
31 | * @param _line_ __LINE__
32 | * @param errn errno
33 | */
34 | EUnsupportedEncodingException(const char *_file_, int _line_, int errn = 0) :
35 | EIOException(_file_, _line_, errn) {
36 | }
37 |
38 | /**
39 | * Constructs an EUnsupportedEncodingException
with the
40 | * specified detail message.
41 | *
42 | * @param _file_ __FILE__.
43 | * @param _line_ __LINE__.
44 | * @param s the detail message.
45 | */
46 | EUnsupportedEncodingException(const char *_file_,
47 | int _line_, const char *s) :
48 | EIOException(_file_, _line_, s) {
49 | }
50 | };
51 |
52 | } /* namespace efc */
53 | #endif /* EUNSUPPORTEDENCODINGEXCEPTION_H_ */
54 |
--------------------------------------------------------------------------------
/efc/inc/concurrent/EBrokenBarrierException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EBrokenBarrierException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EBrokenBarrierException_HH_
9 | #define EBrokenBarrierException_HH_
10 |
11 | #include "../EException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EBROKENBARRIEREXCEPTION EBROKENBARRIEREXCEPTION(__FILE__, __LINE__, errno)
16 | #define EBROKENBARRIEREXCEPTIONS(msg) EBROKENBARRIEREXCEPTION(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Exception thrown when a thread tries to wait upon a barrier that is
20 | * in a broken state, or which enters the broken state while the thread
21 | * is waiting.
22 | *
23 | * @see CyclicBarrier
24 | *
25 | * @since 1.5
26 | *
27 | */
28 |
29 | class EBrokenBarrierException: public EException {
30 | public:
31 | /**
32 | * Constructs an EBrokenBarrierException
with no
33 | * detail message.
34 | *
35 | * @param _file_ __FILE__
36 | * @param _line_ __LINE__
37 | * @param errn errno
38 | */
39 | EBrokenBarrierException(const char *_file_, int _line_, int errn = 0) :
40 | EException(_file_, _line_, errn) {
41 | }
42 |
43 | /**
44 | * Constructs an EBrokenBarrierException
with the
45 | * specified detail message.
46 | *
47 | * @param _file_ __FILE__.
48 | * @param _line_ __LINE__.
49 | * @param s the detail message.
50 | */
51 | EBrokenBarrierException(const char *_file_,
52 | int _line_, const char *s) :
53 | EException(_file_, _line_, s) {
54 | }
55 | };
56 |
57 | } /* namespace efc */
58 | #endif /* EBrokenBarrierException_HH_ */
59 |
--------------------------------------------------------------------------------
/efc/inc/concurrent/ECallable.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * ECallable.hh
3 | *
4 | * Created on: 2013-8-19
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ECALLABLE_HH_
9 | #define ECALLABLE_HH_
10 |
11 | #include "../ESharedPtr.hh"
12 | #include "../EException.hh"
13 |
14 | #ifdef CPP11_SUPPORT
15 | #include ECancellationException
with no
27 | * detail message.
28 | *
29 | * @param _file_ __FILE__
30 | * @param _line_ __LINE__
31 | * @param errn errno
32 | */
33 | ECancellationException(const char *_file_, int _line_, int errn = 0) :
34 | EIllegalStateException(_file_, _line_, errn) {
35 | }
36 |
37 | /**
38 | * Constructs an ECancellationException
with the
39 | * specified detail message.
40 | *
41 | * @param _file_ __FILE__.
42 | * @param _line_ __LINE__.
43 | * @param s the detail message.
44 | */
45 | ECancellationException(const char *_file_, int _line_,
46 | const char *s) :
47 | EIllegalStateException(_file_, _line_, s) {
48 | }
49 | };
50 |
51 | } /* namespace efc */
52 | #endif /* ECANCELLATIONEXCEPTION_HH_ */
53 |
--------------------------------------------------------------------------------
/efc/inc/concurrent/ERejectedExecutionHandler.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * ERejectedExecutionHandler.hh
3 | *
4 | * Created on: 2015-3-5
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EREJECTEDEXECUTIONHANDLER_HH_
9 | #define EREJECTEDEXECUTIONHANDLER_HH_
10 |
11 | #include "../EObject.hh"
12 |
13 | namespace efc {
14 |
15 | interface ERunnable;
16 | class EThreadPoolExecutor;
17 |
18 | /**
19 | * A handler for tasks that cannot be executed by a {@link ThreadPoolExecutor}.
20 | *
21 | * @since 1.5
22 | */
23 |
24 | interface ERejectedExecutionHandler : virtual public EObject {
25 | virtual ~ERejectedExecutionHandler(){}
26 |
27 | /**
28 | * Method that may be invoked by a {@link ThreadPoolExecutor} when
29 | * {@link ThreadPoolExecutor#execute execute} cannot accept a
30 | * task. This may occur when no more threads or queue slots are
31 | * available because their bounds would be exceeded, or upon
32 | * shutdown of the Executor.
33 | *
34 | *
23 | * class SimpleThreadFactory implements ThreadFactory {
24 | * public Thread newThread(Runnable r) {
25 | * return new Thread(r);
26 | * }
27 | * }
28 | *
29 | *
30 | * The {@link Executors#defaultThreadFactory} method provides a more
31 | * useful simple implementation, that sets the created thread context
32 | * to known values before returning it.
33 | * @since 1.5
34 | */
35 |
36 | interface EThreadFactory : virtual public EObject {
37 | virtual ~EThreadFactory(){}
38 |
39 | /**
40 | * Constructs a new {@code Thread}. Implementations may also initialize
41 | * priority, name, daemon status, {@code ThreadGroup}, etc.
42 | *
43 | * @param r a runnable to be executed by new thread instance
44 | * @return constructed thread, or {@code null} if the request to
45 | * create a thread is rejected
46 | */
47 | virtual EThread* newThread(spETimeoutException
with no
33 | * detail message.
34 | *
35 | * @param _file_ __FILE__
36 | * @param _line_ __LINE__
37 | * @param errn errno
38 | */
39 | ETimeoutException(const char *_file_, int _line_, int errn = 0) :
40 | EException(_file_, _line_, errn) {
41 | }
42 |
43 | /**
44 | * Constructs an ETimeoutException
with the
45 | * specified detail message.
46 | *
47 | * @param _file_ __FILE__.
48 | * @param _line_ __LINE__.
49 | * @param s the detail message.
50 | */
51 | ETimeoutException(const char *_file_, int _line_, const char *s, int errn = 0) :
52 | EException(_file_, _line_, s, errn) {
53 | }
54 | };
55 |
56 | } /* namespace efc */
57 | #endif /* ETIMEOUTEXCEPTION_H_ */
58 |
--------------------------------------------------------------------------------
/efc/inc/cpp11/EScopeGuard.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EScopeGuard.hh
3 | *
4 | * Created on: 2015-9-18
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ESCOPEGUARD_HH_
9 | #define ESCOPEGUARD_HH_
10 |
11 | #include "../../EBase.hh"
12 |
13 | #ifdef CPP11_SUPPORT
14 |
15 | namespace efc {
16 |
17 | //@see: http://the-witness.net/news/2012/11/scopeexit-in-c11/
18 |
19 | /** How to use it:
20 | // 1. MakeScopeGuard
21 | {
22 | auto onFailureRollback = MakeScopeGuard([&] {
23 | LOG("onFailureRollback...");
24 | });
25 |
26 | ...
27 |
28 | onFailureRollback.dismiss();
29 | }
30 |
31 | // 2. ON_SCOPE_EXIT
32 | {
33 | ON_SCOPE_EXIT( ... );
34 | ...
35 | }
36 |
37 | // 3. ON_FINALLY_NOTHROW
38 | {
39 | ON_FINALLY_NOTHROW(
40 | ...
41 | ) {
42 | ...
43 | }}
44 | }
45 | */
46 |
47 | template EAsynchronousCloseException
with no
30 | * detail message.
31 | *
32 | * @param _file_ __FILE__
33 | * @param _line_ __LINE__
34 | * @param errn errno
35 | */
36 | EAsynchronousCloseException(const char *_file_, int _line_, int errn = 0) :
37 | EClosedChannelException(_file_, _line_, errn) {
38 | }
39 |
40 | /**
41 | * Constructs an EAsynchronousCloseException
with the
42 | * specified detail message.
43 | *
44 | * @param _file_ __FILE__.
45 | * @param _line_ __LINE__.
46 | * @param s the detail message.
47 | */
48 | EAsynchronousCloseException(const char *_file_, int _line_, const char *s, int errn = 0) :
49 | EClosedChannelException(_file_, _line_, s, errn) {
50 | }
51 | };
52 |
53 | } /* namespace nio */
54 | } /* namespace efc */
55 | #endif /* EAsynchronousCloseException_HH_ */
56 |
--------------------------------------------------------------------------------
/efc/nio/inc/EBufferOverflowException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EBufferOverflowException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EBUFFEROVERFLOWEXCEPTION_HH_
9 | #define EBUFFEROVERFLOWEXCEPTION_HH_
10 |
11 | #include "../../inc/ERuntimeException.hh"
12 |
13 | namespace efc {
14 | namespace nio {
15 |
16 | #define EBUFFEROVERFLOWEXCEPTION EBufferOverflowException(__FILE__, __LINE__, errno)
17 | #define EBUFFEROVERFLOWEXCEPTIONS(msg) EBufferOverflowException(__FILE__, __LINE__, msg)
18 |
19 |
20 | /**
21 | * Unchecked exception thrown when a relative put operation reaches
22 | * the target buffer's limit.
23 | */
24 |
25 | class EBufferOverflowException: public ERuntimeException {
26 | public:
27 | /**
28 | * Constructs an EBufferOverflowException
with no
29 | * detail message.
30 | *
31 | * @param _file_ __FILE__
32 | * @param _line_ __LINE__
33 | * @param errn errno
34 | */
35 | EBufferOverflowException(const char *_file_, int _line_, int errn = 0) :
36 | ERuntimeException(_file_, _line_, errn) {
37 | }
38 |
39 | /**
40 | * Constructs an EBufferOverflowException
with the
41 | * specified detail message.
42 | *
43 | * @param _file_ __FILE__.
44 | * @param _line_ __LINE__.
45 | * @param s the detail message.
46 | */
47 | EBufferOverflowException(const char *_file_,
48 | int _line_, const char *s) :
49 | ERuntimeException(_file_, _line_, s) {
50 | }
51 | };
52 |
53 | } /* namespace nio */
54 | } /* namespace efc */
55 | #endif /* EBUFFEROVERFLOWEXCEPTION_HH_ */
56 |
--------------------------------------------------------------------------------
/efc/nio/inc/EBufferUnderflowException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EBufferUnderflowException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EBUFFERUNDERFLOWEXCEPTION_HH_
9 | #define EBUFFERUNDERFLOWEXCEPTION_HH_
10 |
11 | #include "../../inc/ERuntimeException.hh"
12 |
13 | namespace efc {
14 | namespace nio {
15 |
16 | #define EBUFFERUNDERFLOWEXCEPTION EBufferUnderflowException(__FILE__, __LINE__, errno)
17 | #define EBUFFERUNDERFLOWEXCEPTIONS(msg) EBufferUnderflowException(__FILE__, __LINE__, msg)
18 |
19 |
20 | /**
21 | * Unchecked exception thrown when a relative get operation reaches
22 | * the source buffer's limit.
23 | */
24 |
25 | class EBufferUnderflowException: public ERuntimeException {
26 | public:
27 | /**
28 | * Constructs an EBufferUnderflowException
with no
29 | * detail message.
30 | *
31 | * @param _file_ __FILE__
32 | * @param _line_ __LINE__
33 | * @param errn errno
34 | */
35 | EBufferUnderflowException(const char *_file_, int _line_, int errn = 0) :
36 | ERuntimeException(_file_, _line_, errn) {
37 | }
38 |
39 | /**
40 | * Constructs an EBufferUnderflowException
with the
41 | * specified detail message.
42 | *
43 | * @param _file_ __FILE__.
44 | * @param _line_ __LINE__.
45 | * @param s the detail message.
46 | */
47 | EBufferUnderflowException(const char *_file_,
48 | int _line_, const char *s) :
49 | ERuntimeException(_file_, _line_, s) {
50 | }
51 | };
52 |
53 | } /* namespace nio */
54 | } /* namespace efc */
55 | #endif /* EBUFFERUNDERFLOWEXCEPTION_HH_ */
56 |
--------------------------------------------------------------------------------
/efc/nio/inc/ECancelledKeyException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * ECancelledKeyException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ECANCELLEDKEYEXCEPTION_HH_
9 | #define ECANCELLEDKEYEXCEPTION_HH_
10 |
11 | #include "../../inc/EIllegalStateException.hh"
12 |
13 | namespace efc {
14 | namespace nio {
15 |
16 | #define ECANCELLEDKEYEXCEPTION ECancelledKeyException(__FILE__, __LINE__, errno)
17 | #define ECANCELLEDKEYEXCEPTIONS(msg) ECancelledKeyException(__FILE__, __LINE__, msg)
18 |
19 | /**
20 | * Unchecked exception thrown when an attempt is made to use
21 | * a selection key that is no longer valid.
22 | *
23 | * @version 1.9, 01/11/19
24 | * @since 1.4
25 | */
26 |
27 | class ECancelledKeyException : public EIllegalStateException {
28 | public:
29 | /**
30 | * Constructs an ECancelledKeyException
with no
31 | * detail message.
32 | *
33 | * @param _file_ __FILE__
34 | * @param _line_ __LINE__
35 | * @param errn errno
36 | */
37 | ECancelledKeyException(const char *_file_, int _line_, int errn = 0) :
38 | EIllegalStateException(_file_, _line_, errn) {
39 | }
40 |
41 | /**
42 | * Constructs an ECancelledKeyException
with the
43 | * specified detail message.
44 | *
45 | * @param _file_ __FILE__.
46 | * @param _line_ __LINE__.
47 | * @param s the detail message.
48 | */
49 | ECancelledKeyException(const char *_file_,
50 | int _line_, const char *s) :
51 | EIllegalStateException(_file_, _line_, s) {
52 | }
53 | };
54 |
55 | } /* namespace nio */
56 | } /* namespace efc */
57 | #endif /* ECANCELLEDKEYEXCEPTION_HH_ */
58 |
--------------------------------------------------------------------------------
/efc/nio/inc/EChannelInputStream.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EChannelInputStream.hh
3 | *
4 | * Created on: 2014-2-8
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ECHANNELINPUTSTREAM_HH_
9 | #define ECHANNELINPUTSTREAM_HH_
10 |
11 | #include "../../inc/EInputStream.hh"
12 | #include "../../inc/ESynchronizeable.hh"
13 | #include "./EByteChannel.hh"
14 |
15 | namespace efc {
16 | namespace nio {
17 |
18 | /**
19 | * This class is defined here rather than in java.nio.channels.Channels
20 | * so that code can be shared with SocketAdaptor.
21 | *
22 | * @since 1.4
23 | */
24 |
25 | class EChannelInputStream: public EInputStream, public ESynchronizeable {
26 | public:
27 | EChannelInputStream(EByteChannel* ch);
28 |
29 | virtual ~EChannelInputStream();
30 |
31 | virtual synchronized int read() THROWS(EIOException);
32 |
33 | virtual synchronized int read(void *b, int len) THROWS(EIOException);
34 |
35 | virtual void close() THROWS(EIOException);
36 |
37 | protected:
38 | EByteChannel* ch;
39 |
40 | virtual int read(EIOByteBuffer* bb) THROWS(EIOException);
41 |
42 | private:
43 | EIOByteBuffer* bb;// = null;
44 | void* bs;// = null; // Invoker's previous array
45 | };
46 |
47 | } /* namespace nio */
48 | } /* namespace efc */
49 | #endif /* ECHANNELINPUTSTREAM_HH_ */
50 |
--------------------------------------------------------------------------------
/efc/nio/inc/EClosedByInterruptException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EClosedByInterruptException.h
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ECLOSEDBYINTERRUPTEXCEPTION_HH_
9 | #define ECLOSEDBYINTERRUPTEXCEPTION_HH_
10 |
11 | #include "./EAsynchronousCloseException.hh"
12 |
13 | namespace efc {
14 | namespace nio {
15 |
16 | #define ECLOSEDBYINTERRUPTEXCEPTION EClosedByInterruptException(__FILE__, __LINE__, errno)
17 | #define ECLOSEDBYINTERRUPTEXCEPTIONS(msg) EClosedByInterruptException(__FILE__, __LINE__, msg)
18 |
19 |
20 | /**
21 | * * Checked exception received by a thread when another thread interrupts it
22 | * while it is blocked in an I/O operation upon a channel. Before this
23 | * exception is thrown the channel will have been closed and the interrupt
24 | * status of the previously-blocked thread will have been set."
25 | */
26 |
27 | class EClosedByInterruptException: public EAsynchronousCloseException {
28 | public:
29 | /**
30 | * Constructs an EClosedByInterruptException
with no
31 | * detail message.
32 | *
33 | * @param _file_ __FILE__
34 | * @param _line_ __LINE__
35 | * @param errn errno
36 | */
37 | EClosedByInterruptException(const char *_file_, int _line_, int errn = 0) :
38 | EAsynchronousCloseException(_file_, _line_, errn) {
39 | }
40 |
41 | /**
42 | * Constructs an EClosedByInterruptException
with the
43 | * specified detail message.
44 | *
45 | * @param _file_ __FILE__.
46 | * @param _line_ __LINE__.
47 | * @param s the detail message.
48 | */
49 | EClosedByInterruptException(const char *_file_, int _line_, const char *s, int errn = 0) :
50 | EAsynchronousCloseException(_file_, _line_, s, errn) {
51 | }
52 | };
53 |
54 | } /* namespace nio */
55 | } /* namespace efc */
56 | #endif /* ECLOSEDBYINTERRUPTEXCEPTION_HH_ */
57 |
--------------------------------------------------------------------------------
/efc/nio/inc/EClosedChannelException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EClosedChannelException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EClosedChannelException_H_
9 | #define EClosedChannelException_H_
10 |
11 | #include "../../inc/EIOException.hh"
12 |
13 | namespace efc {
14 | namespace nio {
15 |
16 | #define ECLOSEDCHANNELEXCEPTION EClosedChannelException(__FILE__, __LINE__, errno)
17 | #define ECLOSEDCHANNELEXCEPTIONS(msg) EClosedChannelException(__FILE__, __LINE__, msg)
18 |
19 | /**
20 | * Checked exception thrown when an attempt is made to invoke or complete an
21 | * I/O operation upon channel that is closed, or at least closed to that
22 | * operation. That this exception is thrown does not necessarily imply that
23 | * the channel is completely closed. A socket channel whose write half has
24 | * been shut down, for example, may still be open for reading.
25 | *
26 | * @version 1.9, 01/11/19
27 | * @since 1.4
28 | */
29 |
30 | class EClosedChannelException: public EIOException {
31 | public:
32 | /**
33 | * Constructs an EClosedChannelException
with no
34 | * detail message.
35 | *
36 | * @param _file_ __FILE__
37 | * @param _line_ __LINE__
38 | * @param errn errno
39 | */
40 | EClosedChannelException(const char *_file_, int _line_, int errn = 0) :
41 | EIOException(_file_, _line_, errn) {
42 | }
43 |
44 | /**
45 | * Constructs an EClosedChannelException
with the
46 | * specified detail message.
47 | *
48 | * @param _file_ __FILE__.
49 | * @param _line_ __LINE__.
50 | * @param s the detail message.
51 | */
52 | EClosedChannelException(const char *_file_, int _line_, const char *s, int errn = 0) :
53 | EIOException(_file_, _line_, s, errn) {
54 | }
55 | };
56 |
57 | } /* namespace nio */
58 | } /* namespace efc */
59 | #endif /* EClosedChannelException_H_ */
60 |
--------------------------------------------------------------------------------
/efc/nio/inc/EClosedSelectorException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EClosedSelectorException.hh
3 | *
4 | * Created on: 2013-12-18
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ECLOSEDSELECTOREXCEPTION_HH_
9 | #define ECLOSEDSELECTOREXCEPTION_HH_
10 |
11 | #include "../../inc/EIllegalStateException.hh"
12 |
13 | namespace efc {
14 | namespace nio {
15 |
16 | #define ECLOSEDSELECTOREXCEPTION EClosedSelectorException(__FILE__, __LINE__, errno)
17 | #define ECLOSEDSELECTOREXCEPTIONS(msg) EClosedSelectorException(__FILE__, __LINE__, msg)
18 |
19 | /**
20 | * Unchecked exception thrown when an attempt is made to invoke an I/O
21 | * operation upon a closed selector.
22 | *
23 | * @version 1.9, 01/11/19
24 | * @since 1.4
25 | */
26 |
27 | class EClosedSelectorException : public EIllegalStateException {
28 | public:
29 | /**
30 | * Constructs an EClosedSelectorException
with no
31 | * detail message.
32 | *
33 | * @param _file_ __FILE__
34 | * @param _line_ __LINE__
35 | * @param errn errno
36 | */
37 | EClosedSelectorException(const char *_file_, int _line_, int errn = 0) :
38 | EIllegalStateException(_file_, _line_, errn) {
39 | }
40 |
41 | /**
42 | * Constructs an EClosedSelectorException
with the
43 | * specified detail message.
44 | *
45 | * @param _file_ __FILE__.
46 | * @param _line_ __LINE__.
47 | * @param s the detail message.
48 | */
49 | EClosedSelectorException(const char *_file_,
50 | int _line_, const char *s) :
51 | EIllegalStateException(_file_, _line_, s) {
52 | }
53 | };
54 |
55 | } /* namespace nio */
56 | } /* namespace efc */
57 | #endif /* ECLOSEDSELECTOREXCEPTION_HH_ */
58 |
--------------------------------------------------------------------------------
/efc/nio/inc/EConnectionPendingException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EConnectionPendingException.hh
3 | *
4 | * Created on: 2013-12-18
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ECONNECTIONPENDINGEXCEPTION_HH_
9 | #define ECONNECTIONPENDINGEXCEPTION_HH_
10 |
11 | #include "../../inc/EIllegalStateException.hh"
12 |
13 | namespace efc {
14 | namespace nio {
15 |
16 | #define ECONNECTIONPENDINGEXCEPTION EConnectionPendingException(__FILE__, __LINE__, errno)
17 | #define ECONNECTIONPENDINGEXCEPTIONS(msg) EConnectionPendingException(__FILE__, __LINE__, msg)
18 |
19 | /**
20 | * Unchecked exception thrown when an attempt is made to connect a {@link
21 | * SocketChannel} for which a non-blocking connection operation is already in
22 | * progress.
23 | */
24 |
25 | class EConnectionPendingException : public EIllegalStateException {
26 | public:
27 | /**
28 | * Constructs an EConnectionPendingException
with no
29 | * detail message.
30 | *
31 | * @param _file_ __FILE__
32 | * @param _line_ __LINE__
33 | * @param errn errno
34 | */
35 | EConnectionPendingException(const char *_file_, int _line_, int errn = 0) :
36 | EIllegalStateException(_file_, _line_, errn) {
37 | }
38 |
39 | /**
40 | * Constructs an EConnectionPendingException
with the
41 | * specified detail message.
42 | *
43 | * @param _file_ __FILE__.
44 | * @param _line_ __LINE__.
45 | * @param s the detail message.
46 | */
47 | EConnectionPendingException(const char *_file_,
48 | int _line_, const char *s) :
49 | EIllegalStateException(_file_, _line_, s) {
50 | }
51 | };
52 |
53 | } /* namespace nio */
54 | } /* namespace efc */
55 | #endif /* ECONNECTIONPENDINGEXCEPTION_HH_ */
56 |
--------------------------------------------------------------------------------
/efc/nio/inc/EFileKey.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EFileKey.hh
3 | *
4 | * Created on: 2014-2-23
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EFILEKEY_HH_
9 | #define EFILEKEY_HH_
10 |
11 | #include "../../EBase.hh"
12 |
13 | namespace efc {
14 | namespace nio {
15 |
16 | class EFileKey {
17 | public:
18 | static EFileKey* create(int fd);
19 |
20 | virtual int hashCode();
21 | boolean equals(EFileKey* obj);
22 |
23 | private:
24 | #ifdef WIN32
25 | long dwVolumeSerialNumber;
26 | long nFileIndexHigh;
27 | long nFileIndexLow;
28 | #else
29 | long st_dev; // ID of device
30 | long st_ino; // Inode number
31 | #endif
32 | EFileKey() { }
33 | };
34 |
35 | } /* namespace nio */
36 | } /* namespace efc */
37 | #endif /* EFILEKEY_HH_ */
38 |
--------------------------------------------------------------------------------
/efc/nio/inc/EInvalidMarkException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EInvalidMarkException.hh
3 | *
4 | * Created on: 2013-12-16
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EINVALIDMARKEXCEPTION_HH_
9 | #define EINVALIDMARKEXCEPTION_HH_
10 |
11 | #include "../../inc/EIllegalStateException.hh"
12 |
13 | namespace efc {
14 |
15 | #define EINVALIDMARKEXCEPTION EInvalidMarkException(__FILE__, __LINE__, errno)
16 | #define EINVALIDMARKEXCEPTIONS(msg) EInvalidMarkException(__FILE__, __LINE__, msg)
17 |
18 | /**
19 | * Unchecked exception thrown when an attempt is made to reset a buffer
20 | * when its mark is not defined.
21 | *
22 | * @version 1.14, 01/05/02
23 | * @since 1.4
24 | */
25 |
26 | class EInvalidMarkException: public EIllegalStateException {
27 | public:
28 | /**
29 | * Constructs an EInvalidMarkException
with no
30 | * detail message.
31 | *
32 | * @param _file_ __FILE__
33 | * @param _line_ __LINE__
34 | * @param errn errno
35 | */
36 | EInvalidMarkException(const char *_file_, int _line_, int errn = 0) :
37 | EIllegalStateException(_file_, _line_, errn) {
38 | }
39 |
40 | /**
41 | * Constructs an EInvalidMarkException
with the
42 | * specified detail message.
43 | *
44 | * @param _file_ __FILE__.
45 | * @param _line_ __LINE__.
46 | * @param s the detail message.
47 | */
48 | EInvalidMarkException(const char *_file_, int _line_,
49 | const char *s) :
50 | EIllegalStateException(_file_, _line_, s) {
51 | }
52 | };
53 |
54 | } /* namespace efc */
55 | #endif /* EINVALIDMARKEXCEPTION_HH_ */
56 |
--------------------------------------------------------------------------------
/efc/nio/inc/ENativeThreadSet.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * ENativeThreadSet.hh
3 | *
4 | * Created on: 2014-2-15
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ENATIVETHREADSET_HH_
9 | #define ENATIVETHREADSET_HH_
10 |
11 | #include "../../inc/EArrayList.hh"
12 | #include "../../inc/ESynchronizeable.hh"
13 |
14 | namespace efc {
15 | namespace nio {
16 |
17 | // Special-purpose data structure for sets of native threads
18 |
19 | class ENativeThreadSet: public ESynchronizeable {
20 | public:
21 | ~ENativeThreadSet();
22 | ENativeThreadSet(int n);
23 |
24 | // Adds the current native thread to this set, returning its index so that
25 | // it can efficiently be removed later.
26 | //
27 | int add();
28 |
29 | // Removes the thread at the given index.
30 | //
31 | void remove(int i);
32 |
33 | // Signals all threads in this set.
34 | //
35 | void signal();
36 |
37 | private:
38 | EArrayListENonReadableChannelException
with no
28 | * detail message.
29 | *
30 | * @param _file_ __FILE__
31 | * @param _line_ __LINE__
32 | * @param errn errno
33 | */
34 | ENonReadableChannelException(const char *_file_, int _line_, int errn = 0) :
35 | EIllegalStateException(_file_, _line_, errn) {
36 | }
37 |
38 | /**
39 | * Constructs an ENonReadableChannelException
with the
40 | * specified detail message.
41 | *
42 | * @param _file_ __FILE__.
43 | * @param _line_ __LINE__.
44 | * @param s the detail message.
45 | */
46 | ENonReadableChannelException(const char *_file_, int _line_,
47 | const char *s) :
48 | EIllegalStateException(_file_, _line_, s) {
49 | }
50 | };
51 |
52 | } /* namespace nio */
53 | } /* namespace efc */
54 | #endif /* ENONREADABLECHANNELEXCEPTION_HH_ */
55 |
--------------------------------------------------------------------------------
/efc/nio/inc/ENonWritableChannelException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * ENonWritableChannelException.hh
3 | *
4 | * Created on: 2013-12-16
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef ENONWRITABLECHANNELEXCEPTION_HH_
9 | #define ENONWRITABLECHANNELEXCEPTION_HH_
10 |
11 | #include "../../inc/EIllegalStateException.hh"
12 |
13 | namespace efc {
14 | namespace nio {
15 |
16 | #define ENONWRITABLECHANNELEXCEPTION ENonWritableChannelException(__FILE__, __LINE__, errno)
17 | #define ENONWRITABLECHANNELEXCEPTIONS(msg) ENonWritableChannelException(__FILE__, __LINE__, msg)
18 |
19 | /**
20 | * Unchecked exception thrown when an attempt is made to write
21 | * to a channel that was not originally opened for writing.
22 | */
23 |
24 | class ENonWritableChannelException: public EIllegalStateException {
25 | public:
26 | /**
27 | * Constructs an ENonWritableChannelException
with no
28 | * detail message.
29 | *
30 | * @param _file_ __FILE__
31 | * @param _line_ __LINE__
32 | * @param errn errno
33 | */
34 | ENonWritableChannelException(const char *_file_, int _line_, int errn = 0) :
35 | EIllegalStateException(_file_, _line_, errn) {
36 | }
37 |
38 | /**
39 | * Constructs an ENonWritableChannelException
with the
40 | * specified detail message.
41 | *
42 | * @param _file_ __FILE__.
43 | * @param _line_ __LINE__.
44 | * @param s the detail message.
45 | */
46 | ENonWritableChannelException(const char *_file_, int _line_,
47 | const char *s) :
48 | EIllegalStateException(_file_, _line_, s) {
49 | }
50 | };
51 |
52 | } /* namespace nio */
53 | } /* namespace efc */
54 | #endif /* ENONWRITABLECHANNELEXCEPTION_HH_ */
55 |
--------------------------------------------------------------------------------
/efc/nio/inc/EOverlappingFileLockException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EOverlappingFileLockException.hh
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EOVERLAPPINGFILELOCKEXCEPTION_HH_
9 | #define EOVERLAPPINGFILELOCKEXCEPTION_HH_
10 |
11 | #include "../../inc/EIllegalStateException.hh"
12 |
13 | namespace efc {
14 | namespace nio {
15 |
16 | #define EOVERLAPPINGFILELOCKEXCEPTION EOverlappingFileLockException(__FILE__, __LINE__, errno)
17 | #define EOVERLAPPINGFILELOCKEXCEPTIONS(msg) EOverlappingFileLockException(__FILE__, __LINE__, msg)
18 |
19 | /**
20 | * Unchecked exception thrown when an attempt is made to acquire a lock on a
21 | * region of a file that overlaps a region already locked by the same Java
22 | * virtual machine, or when another thread is already waiting to lock an
23 | * overlapping region of the same file."
24 | */
25 |
26 | class EOverlappingFileLockException : public EIllegalStateException {
27 | public:
28 | /**
29 | * Constructs an EOverlappingFileLockException
with no
30 | * detail message.
31 | *
32 | * @param _file_ __FILE__
33 | * @param _line_ __LINE__
34 | * @param errn errno
35 | */
36 | EOverlappingFileLockException(const char *_file_, int _line_, int errn = 0) :
37 | EIllegalStateException(_file_, _line_, errn) {
38 | }
39 |
40 | /**
41 | * Constructs an EOverlappingFileLockException
with the
42 | * specified detail message.
43 | *
44 | * @param _file_ __FILE__.
45 | * @param _line_ __LINE__.
46 | * @param s the detail message.
47 | */
48 | EOverlappingFileLockException(const char *_file_,
49 | int _line_, const char *s) :
50 | EIllegalStateException(_file_, _line_, s) {
51 | }
52 | };
53 |
54 | } /* namespace nio */
55 | } /* namespace efc */
56 | #endif /* EOVERLAPPINGFILELOCKEXCEPTION_HH_ */
57 |
--------------------------------------------------------------------------------
/efc/nio/inc/EReadOnlyBufferException.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EReadOnlyBufferException.h
3 | *
4 | * Created on: 2013-3-14
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EREADONLYBUFFEREXCEPTION_HH_
9 | #define EREADONLYBUFFEREXCEPTION_HH_
10 |
11 | #include "../../inc/EUnsupportedOperationException.hh"
12 |
13 | namespace efc {
14 | namespace nio {
15 |
16 | #define EREADONLYBUFFEREXCEPTION EReadOnlyBufferException(__FILE__, __LINE__, errno)
17 | #define EREADONLYBUFFEREXCEPTIONS(msg) EReadOnlyBufferException(__FILE__, __LINE__, msg)
18 |
19 | /**
20 | * Unchecked exception thrown when a content-mutation method such as
21 | * put or compact is invoked upon a read-only buffer.
22 | */
23 |
24 | class EReadOnlyBufferException: public EUnsupportedOperationException {
25 | public:
26 | /**
27 | * Constructs an EReadOnlyBufferException
with no
28 | * detail message.
29 | *
30 | * @param _file_ __FILE__
31 | * @param _line_ __LINE__
32 | * @param errn errno
33 | */
34 | EReadOnlyBufferException(const char *_file_, int _line_, int errn = 0) :
35 | EUnsupportedOperationException(_file_, _line_, errn) {
36 | }
37 |
38 | /**
39 | * Constructs an EReadOnlyBufferException
with the
40 | * specified detail message.
41 | *
42 | * @param _file_ __FILE__.
43 | * @param _line_ __LINE__.
44 | * @param s the detail message.
45 | */
46 | EReadOnlyBufferException(const char *_file_, int _line_, const char *s, int errn = 0) :
47 | EUnsupportedOperationException(_file_, _line_, s, errn) {
48 | }
49 | };
50 |
51 | } /* namespace nio */
52 | } /* namespace efc */
53 | #endif /* EREADONLYBUFFEREXCEPTION_HH_ */
54 |
--------------------------------------------------------------------------------
/efc/nio/src/EChannelInputStream.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * EChannelInputStream.cpp
3 | *
4 | * Created on: 2014-2-8
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #include "../inc/EChannelInputStream.hh"
9 | #include "../../inc/EUnsupportedOperationException.hh"
10 |
11 | namespace efc {
12 | namespace nio {
13 |
14 | EChannelInputStream::EChannelInputStream(EByteChannel* ch) :
15 | bb(null), bs(null) {
16 | this->ch = ch;
17 | }
18 |
19 | EChannelInputStream::~EChannelInputStream() {
20 | delete this->bb;
21 | }
22 |
23 | int EChannelInputStream::read() {
24 | SYNCHRONIZED(this) {
25 | return EInputStream::read();
26 | }}
27 | }
28 |
29 | int EChannelInputStream::read(void* b, int len) {
30 | SYNCHRONIZED(this) {
31 | if (len < 0) {
32 | throw EINDEXOUTOFBOUNDSEXCEPTION;
33 | } else if (len == 0)
34 | return 0;
35 |
36 | ES_ASSERT(b);
37 |
38 | if (this->bs != b) {
39 | delete bb;
40 | bb = EIOByteBuffer::wrap(b, len);
41 | }
42 | bb->limit(ES_MIN(len, bb->capacity()));
43 | bb->position(0);
44 | this->bs = b;
45 | return read(bb);
46 | }}
47 | }
48 |
49 | void EChannelInputStream::close() {
50 | ch->close();
51 | }
52 |
53 | int EChannelInputStream::read(EIOByteBuffer* bb) {
54 | throw EUNSUPPORTEDOPERATIONEXCEPTION;
55 | }
56 |
57 | } /* namespace nio */
58 | } /* namespace efc */
59 |
--------------------------------------------------------------------------------
/efc/nio/src/EDatagramDispatcher.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * EDatagramDispatcher.hh
3 | *
4 | * Created on: 2016-8-24
5 | * Author: cxxjava@163.com
6 | */
7 |
8 | #ifndef EDATAGRAMDISPATCHER_HH_
9 | #define EDATAGRAMDISPATCHER_HH_
10 |
11 | #include "../../inc/EA.hh"
12 | #include "../inc/EIOByteBuffer.hh"
13 | #include "../../inc/EIOException.hh"
14 |
15 | namespace efc {
16 | namespace nio {
17 |
18 | /**
19 | * Allows different platforms to call different native methods
20 | * for read and write operations.
21 | */
22 |
23 | class EDatagramDispatcher {
24 | public:
25 | static int read(int fd, void* address, int len) THROWS(EIOException);
26 | static long readv(int fd, void* address, int len) THROWS(EIOException);
27 | static int write(int fd, void* address, int len) THROWS(EIOException);
28 | static long writev(int fd, void* address, int len) THROWS(EIOException);
29 |
30 | static int read(int fd, EIOByteBuffer* bb) THROWS(EIOException);
31 | static int read(int fd, EA